bootstrap-vue-top 1.0.13 → 1.0.15
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 +2 -7
- package/.browserslistrc +0 -12
- package/postcss.config.js +0 -5
- package/src/components/accordion/accordion-item.vue +0 -27
- package/src/components/accordion/accordion-keys.js +0 -1
- package/src/components/accordion/accordion.vue +0 -84
- package/src/components/alert/alert.js +0 -10
- package/src/components/alert-box/alert-box.vue +0 -73
- package/src/components/alert-box/index.js +0 -25
- package/src/components/alert-confirm/alert-confirm.vue +0 -80
- package/src/components/alert-confirm/index.js +0 -26
- package/src/components/alert-message/alert-message.vue +0 -63
- package/src/components/alert-message/index.js +0 -27
- package/src/components/backtop/backtop.vue +0 -61
- package/src/components/carousel/carousel.vue +0 -107
- package/src/components/collapse/collapse.js +0 -8
- package/src/components/dropdown/dropdown.js +0 -11
- package/src/components/image-preview/image-preview.vue +0 -261
- package/src/components/image-preview/index.js +0 -26
- package/src/components/loading/index.js +0 -45
- package/src/components/loading/loading-fullscreen.vue +0 -47
- package/src/components/loading/loading.vue +0 -47
- package/src/components/modal/modal.vue +0 -83
- package/src/components/modal-2/counter.js +0 -25
- package/src/components/modal-2/modal-2.vue +0 -256
- package/src/components/offcanvas/offcanvas.vue +0 -71
- package/src/components/pagination/pagination.vue +0 -216
- package/src/components/popover/popover.js +0 -10
- package/src/components/scrollspy/scrollspy.js +0 -16
- package/src/components/table/table-col.vue +0 -61
- package/src/components/table/table-keys.js +0 -2
- package/src/components/table/table.vue +0 -320
- package/src/components/tabs/tab-pane.vue +0 -32
- package/src/components/tabs/tabs-keys.js +0 -1
- package/src/components/tabs/tabs.vue +0 -240
- package/src/components/toast/index.js +0 -29
- package/src/components/toast/toast.vue +0 -92
- package/src/components/tooltip/tooltip.js +0 -10
- package/src/components/tree/tree-keys.js +0 -7
- package/src/components/tree/tree-node.vue +0 -144
- package/src/components/tree/tree.vue +0 -92
- package/src/components/treetable/treetable-col.vue +0 -37
- package/src/components/treetable/treetable-keys.js +0 -3
- package/src/components/treetable/treetable-node.vue +0 -104
- package/src/components/treetable/treetable.vue +0 -114
- package/src/components/uploader/file-uploader.vue +0 -68
- package/src/components/uploader/image-many-uploader.vue +0 -173
- package/src/components/uploader/image-one-uploader.vue +0 -78
- package/src/index.js +0 -64
- package/src/styles/alert.scss +0 -33
- package/src/styles/backtop.scss +0 -7
- package/src/styles/image-preview.scss +0 -11
- package/src/styles/index.scss +0 -97
- package/src/styles/loading.scss +0 -12
- package/src/styles/modal-2.scss +0 -8
- package/src/styles/uploader.scss +0 -29
- package/vite.config.js +0 -58
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Teleport to="body">
|
|
3
|
-
<Transition name="fadeIn">
|
|
4
|
-
<div v-show="visible" ref="modalRef" class="modal modal-2" tabindex="-1" role="dialog" aria-modal="true">
|
|
5
|
-
<div class="modal-dialog" :class="dialogClass">
|
|
6
|
-
<div v-if="rendered" ref="contentRef" class="modal-content">
|
|
7
|
-
<div ref="headerRef" class="modal-header" :style="{ cursor: draggable ? 'move' : 'auto' }">
|
|
8
|
-
<h1 class="modal-title fs-5">{{ title }}</h1>
|
|
9
|
-
<button type="button" class="btn-close" @click="visible = false" aria-label="Close"></button>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="modal-body">
|
|
12
|
-
<slot></slot>
|
|
13
|
-
</div>
|
|
14
|
-
<div v-if="$slots.footer" class="modal-footer">
|
|
15
|
-
<slot name="footer"></slot>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</Transition>
|
|
21
|
-
</Teleport>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script setup>
|
|
25
|
-
import { ref, shallowRef, watch, nextTick, onBeforeUnmount, onMounted } from 'vue';
|
|
26
|
-
import { createFocusTrap } from 'focus-trap';
|
|
27
|
-
import counter from './counter.js';
|
|
28
|
-
|
|
29
|
-
const modalRef = shallowRef(null);
|
|
30
|
-
const contentRef = shallowRef(null);
|
|
31
|
-
const headerRef = shallowRef(null);
|
|
32
|
-
|
|
33
|
-
const visible = defineModel({ type: Boolean, required: true });
|
|
34
|
-
const rendered = ref(false);
|
|
35
|
-
let index = 0;
|
|
36
|
-
let focusTrapInstance = null;
|
|
37
|
-
const props = defineProps({
|
|
38
|
-
title: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: 'Modal2'
|
|
41
|
-
},
|
|
42
|
-
backdrop: {
|
|
43
|
-
type: [String, Boolean],
|
|
44
|
-
default: true
|
|
45
|
-
},
|
|
46
|
-
dialogClass: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: null
|
|
49
|
-
},
|
|
50
|
-
destory: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false
|
|
53
|
-
},
|
|
54
|
-
draggable: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: false
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
watch(visible, (val) => {
|
|
61
|
-
val ? open() : close();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
function open() {
|
|
65
|
-
if (counter.get() === 0) {
|
|
66
|
-
if (document.body.scrollHeight > window.innerHeight) {
|
|
67
|
-
document.body.style.cssText = `overflow: hidden; padding-right: ${window.innerWidth - document.body.clientWidth}px;`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
rendered.value = true;
|
|
72
|
-
|
|
73
|
-
nextTick(() => {
|
|
74
|
-
//焦点陷阱
|
|
75
|
-
if (focusTrapInstance === null) {
|
|
76
|
-
focusTrapInstance = createFocusTrap(modalRef.value, {
|
|
77
|
-
initialFocus: false,
|
|
78
|
-
isolateSubtrees: true
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
focusTrapInstance.activate();
|
|
82
|
-
|
|
83
|
-
//开启拖动
|
|
84
|
-
if (props.draggable) {
|
|
85
|
-
onDraggable();
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
index = counter.increment();
|
|
90
|
-
|
|
91
|
-
//添加监听keydown
|
|
92
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function close() {
|
|
96
|
-
counter.decrement();
|
|
97
|
-
if (counter.get() === 0) {
|
|
98
|
-
if (document.body.scrollHeight > window.innerHeight) {
|
|
99
|
-
document.body.style = null;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (props.destory) {
|
|
104
|
-
rendered.value = false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
//停止焦点陷阱
|
|
108
|
-
if (focusTrapInstance !== null) {
|
|
109
|
-
focusTrapInstance.deactivate();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
//关闭拖动
|
|
113
|
-
if (props.draggable) {
|
|
114
|
-
offDraggable();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
//移除监听keydown
|
|
118
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function handleKeyDown(event) {
|
|
122
|
-
if (event.key === 'Escape' && index === counter.get()) {
|
|
123
|
-
visible.value = false;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//拖动
|
|
128
|
-
let currentX = 0;
|
|
129
|
-
let currentY = 0;
|
|
130
|
-
let initialX = 0;
|
|
131
|
-
let initialY = 0;
|
|
132
|
-
let xOffset = 0;
|
|
133
|
-
let yOffset = 0;
|
|
134
|
-
let rafId = null;
|
|
135
|
-
let removeWillChangeTimeout = null;
|
|
136
|
-
const onDraggable = () => {
|
|
137
|
-
headerRef.value.addEventListener('mousedown', handleMousedown);
|
|
138
|
-
window.addEventListener('resize', resetPosition);
|
|
139
|
-
};
|
|
140
|
-
const offDraggable = () => {
|
|
141
|
-
if (props.destory) {
|
|
142
|
-
resetPosition();
|
|
143
|
-
} else {
|
|
144
|
-
headerRef.value.removeEventListener('mousedown', handleMousedown);
|
|
145
|
-
}
|
|
146
|
-
window.removeEventListener('resize', resetPosition);
|
|
147
|
-
};
|
|
148
|
-
function handleMousedown(e) {
|
|
149
|
-
e.preventDefault();
|
|
150
|
-
|
|
151
|
-
if (removeWillChangeTimeout !== null) {
|
|
152
|
-
clearTimeout(removeWillChangeTimeout);
|
|
153
|
-
removeWillChangeTimeout = null;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
contentRef.value.style.willChange = 'transform';
|
|
157
|
-
|
|
158
|
-
initialX = e.clientX - xOffset;
|
|
159
|
-
initialY = e.clientY - yOffset;
|
|
160
|
-
|
|
161
|
-
document.addEventListener('mousemove', handleMousemove);
|
|
162
|
-
document.addEventListener('mouseup', handleMouseup);
|
|
163
|
-
}
|
|
164
|
-
function handleMousemove(e) {
|
|
165
|
-
e.preventDefault();
|
|
166
|
-
|
|
167
|
-
currentX = e.clientX - initialX;
|
|
168
|
-
currentY = e.clientY - initialY;
|
|
169
|
-
xOffset = currentX;
|
|
170
|
-
yOffset = currentY;
|
|
171
|
-
|
|
172
|
-
if (rafId === null) {
|
|
173
|
-
rafId = requestAnimationFrame(updatePosition);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
function handleMouseup() {
|
|
177
|
-
// 延迟移除 will-change
|
|
178
|
-
removeWillChangeTimeout = setTimeout(() => {
|
|
179
|
-
contentRef.value.style.willChange = 'auto';
|
|
180
|
-
}, 300);
|
|
181
|
-
|
|
182
|
-
if (rafId !== null) {
|
|
183
|
-
cancelAnimationFrame(rafId);
|
|
184
|
-
rafId = null;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
document.removeEventListener('mousemove', handleMousemove);
|
|
188
|
-
document.removeEventListener('mouseup', handleMouseup);
|
|
189
|
-
}
|
|
190
|
-
function updatePosition() {
|
|
191
|
-
contentRef.value.style.transform = `translate(${currentX}px, ${currentY}px)`;
|
|
192
|
-
rafId = null;
|
|
193
|
-
}
|
|
194
|
-
function resetPosition() {
|
|
195
|
-
xOffset = 0;
|
|
196
|
-
yOffset = 0;
|
|
197
|
-
if (contentRef.value) {
|
|
198
|
-
contentRef.value.style.transform = 'none';
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
onMounted(() => {
|
|
203
|
-
if (props.backdrop === true) {
|
|
204
|
-
modalRef.value.addEventListener('click', function (event) {
|
|
205
|
-
if (event.target === modalRef.value) {
|
|
206
|
-
visible.value = false;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
} else if (props.backdrop === 'static') {
|
|
210
|
-
let count = 0;
|
|
211
|
-
modalRef.value.addEventListener('click', function (event) {
|
|
212
|
-
if (event.target === modalRef.value) {
|
|
213
|
-
if (count === 0) {
|
|
214
|
-
count++;
|
|
215
|
-
contentRef.value.style.transition = 'transform 0.3s ease-out';
|
|
216
|
-
contentRef.value.style.transform = 'scale(1.02)';
|
|
217
|
-
contentRef.value.addEventListener(
|
|
218
|
-
'transitionend',
|
|
219
|
-
function () {
|
|
220
|
-
contentRef.value.style.transform = 'none';
|
|
221
|
-
contentRef.value.addEventListener(
|
|
222
|
-
'transitionend',
|
|
223
|
-
function () {
|
|
224
|
-
contentRef.value.style.transition = 'none';
|
|
225
|
-
count--;
|
|
226
|
-
},
|
|
227
|
-
{ once: true }
|
|
228
|
-
);
|
|
229
|
-
},
|
|
230
|
-
{ once: true }
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
onBeforeUnmount(() => {
|
|
239
|
-
counter.reset();
|
|
240
|
-
|
|
241
|
-
if (document.body.scrollHeight > window.innerHeight) {
|
|
242
|
-
document.body.style = null;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
//停止焦点陷阱
|
|
246
|
-
if (focusTrapInstance !== null) {
|
|
247
|
-
focusTrapInstance.deactivate();
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
//移除监听
|
|
251
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
252
|
-
document.removeEventListener('mousemove', handleMousemove);
|
|
253
|
-
document.removeEventListener('mouseup', handleMouseup);
|
|
254
|
-
window.removeEventListener('resize', resetPosition);
|
|
255
|
-
});
|
|
256
|
-
</script>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="offcanvasClass" :style="offcanvasStyle" tabindex="-1" :id="id" :aria-labelledby="`${id}Label`">
|
|
3
|
-
<div class="offcanvas-header">
|
|
4
|
-
<h5 class="offcanvas-title" :id="`${id}Label`">{{ title }}</h5>
|
|
5
|
-
<button
|
|
6
|
-
type="button"
|
|
7
|
-
class="btn-close"
|
|
8
|
-
data-bs-dismiss="offcanvas"
|
|
9
|
-
:data-bs-target="`#${id}`"
|
|
10
|
-
aria-label="Close"
|
|
11
|
-
></button>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="offcanvas-body">
|
|
14
|
-
<slot></slot>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup>
|
|
20
|
-
import { useId, onMounted, onBeforeUnmount, computed } from 'vue';
|
|
21
|
-
import Offcanvas from 'bootstrap/js/dist/offcanvas';
|
|
22
|
-
|
|
23
|
-
const emit = defineEmits(['offcanvas-shown']);
|
|
24
|
-
|
|
25
|
-
const id = useId();
|
|
26
|
-
const props = defineProps({
|
|
27
|
-
title: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: 'Offcanvas'
|
|
30
|
-
},
|
|
31
|
-
backdrop: {
|
|
32
|
-
type: [String, Boolean],
|
|
33
|
-
default: true
|
|
34
|
-
},
|
|
35
|
-
offcanvasClass: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: 'offcanvas offcanvas-start'
|
|
38
|
-
},
|
|
39
|
-
offcanvasStyle: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: null
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
let offcanvas = null;
|
|
46
|
-
onMounted(() => {
|
|
47
|
-
if (offcanvas === null) {
|
|
48
|
-
const offcanvasEl = document.getElementById(id);
|
|
49
|
-
offcanvas = new Offcanvas(offcanvasEl, {
|
|
50
|
-
backdrop: props.backdrop
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
offcanvasEl.addEventListener('shown.bs.offcanvas', (event) => {
|
|
54
|
-
emit('offcanvas-shown');
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
onBeforeUnmount(() => {
|
|
60
|
-
if (offcanvas !== null) {
|
|
61
|
-
offcanvas.dispose();
|
|
62
|
-
offcanvas = null;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
defineExpose({
|
|
67
|
-
toggle: function () {
|
|
68
|
-
offcanvas.toggle();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
</script>
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav class="row align-items-center g-3" :class="navClass">
|
|
3
|
-
<div v-if="mode === 'full'" class="col-auto" :class="totalClass">共 {{ total }} 条</div>
|
|
4
|
-
<ul v-if="pages > 1" class="col-auto pagination mb-0" :class="paginationClass">
|
|
5
|
-
<li class="page-item" :class="{ disabled: currentPage === 1 }">
|
|
6
|
-
<span v-if="currentPage === 1" class="page-link"><BiChevronLeft /></span>
|
|
7
|
-
<button v-else type="button" class="page-link" @click="emit('currentChange', currentPage - 1)">
|
|
8
|
-
<BiChevronLeft />
|
|
9
|
-
</button>
|
|
10
|
-
</li>
|
|
11
|
-
|
|
12
|
-
<template v-if="mode === 'simple'">
|
|
13
|
-
<li class="page-item disabled">
|
|
14
|
-
<span class="page-link">{{ currentPage }}/{{ Math.ceil(total / pageSize) }}</span>
|
|
15
|
-
</li>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<template v-if="mode === 'base' || mode === 'full'">
|
|
19
|
-
<li class="page-item" :class="{ active: currentPage === 1 }">
|
|
20
|
-
<span v-if="currentPage === 1" class="page-link" aria-current="page">1</span>
|
|
21
|
-
<button v-else type="button" class="page-link" @click="emit('currentChange', 1)">1</button>
|
|
22
|
-
</li>
|
|
23
|
-
|
|
24
|
-
<li v-if="showPrevMore" class="page-item disabled">
|
|
25
|
-
<span class="page-link"><BiThreeDots /></span>
|
|
26
|
-
</li>
|
|
27
|
-
|
|
28
|
-
<li v-for="p in pagers" class="page-item" :class="{ active: currentPage === p }" :key="p">
|
|
29
|
-
<span v-if="currentPage === p" class="page-link" aria-current="page">{{ p }}</span>
|
|
30
|
-
<button v-else type="button" class="page-link" @click="emit('currentChange', p)">
|
|
31
|
-
{{ p }}
|
|
32
|
-
</button>
|
|
33
|
-
</li>
|
|
34
|
-
|
|
35
|
-
<li v-if="showNextMore" class="page-item disabled">
|
|
36
|
-
<span class="page-link"><BiThreeDots /></span>
|
|
37
|
-
</li>
|
|
38
|
-
|
|
39
|
-
<li class="page-item" :class="{ active: currentPage === pages }">
|
|
40
|
-
<span v-if="currentPage == pages" class="page-link" aria-current="page">{{ pages }}</span>
|
|
41
|
-
<button v-else type="button" class="page-link" @click="emit('currentChange', pages)">
|
|
42
|
-
{{ pages }}
|
|
43
|
-
</button>
|
|
44
|
-
</li>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<li class="page-item" :class="{ disabled: currentPage === pages }">
|
|
48
|
-
<span v-if="currentPage === pages" class="page-link"><BiChevronRight /></span>
|
|
49
|
-
<button v-else type="button" class="page-link" @click="emit('currentChange', currentPage + 1)">
|
|
50
|
-
<BiChevronRight />
|
|
51
|
-
</button>
|
|
52
|
-
</li>
|
|
53
|
-
</ul>
|
|
54
|
-
|
|
55
|
-
<select
|
|
56
|
-
v-if="mode === 'full'"
|
|
57
|
-
class="form-select col-auto"
|
|
58
|
-
:class="pageSizeClass"
|
|
59
|
-
style="width: 8rem"
|
|
60
|
-
:value="pageSize"
|
|
61
|
-
@change="(event) => emit('sizeChange', parseInt(event.currentTarget.value))"
|
|
62
|
-
>
|
|
63
|
-
<option v-for="item in [10, 20, 50, 100]" :value="item">{{ item }}条/页</option>
|
|
64
|
-
</select>
|
|
65
|
-
|
|
66
|
-
<div v-if="mode === 'full' && pages > 7" class="col-auto input-group" :class="pageGoClass" style="width: 8rem">
|
|
67
|
-
<span class="input-group-text">Go</span>
|
|
68
|
-
<input
|
|
69
|
-
class="form-control"
|
|
70
|
-
type="number"
|
|
71
|
-
title="输入页码回车"
|
|
72
|
-
oninput="this.value = Math.min(999, Math.max(1, this.value))"
|
|
73
|
-
onblur="this.value = null"
|
|
74
|
-
@keyup.enter="(event) => emit('currentChange', parseInt(event.currentTarget.value))"
|
|
75
|
-
/>
|
|
76
|
-
</div>
|
|
77
|
-
</nav>
|
|
78
|
-
</template>
|
|
79
|
-
|
|
80
|
-
<script setup>
|
|
81
|
-
import { computed, watchEffect, ref } from 'vue';
|
|
82
|
-
|
|
83
|
-
const emit = defineEmits(['currentChange', 'sizeChange']);
|
|
84
|
-
|
|
85
|
-
const props = defineProps({
|
|
86
|
-
mode: {
|
|
87
|
-
type: String,
|
|
88
|
-
default: 'base',
|
|
89
|
-
validator(value) {
|
|
90
|
-
return ['simple', 'base', 'full'].includes(value);
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
total: {
|
|
94
|
-
type: Number,
|
|
95
|
-
default: 0
|
|
96
|
-
},
|
|
97
|
-
currentPage: {
|
|
98
|
-
type: Number,
|
|
99
|
-
default: 1
|
|
100
|
-
},
|
|
101
|
-
pageSize: {
|
|
102
|
-
type: Number,
|
|
103
|
-
default: 20,
|
|
104
|
-
validator(value) {
|
|
105
|
-
return [10, 20, 50, 100].includes(value);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
pagerCount: {
|
|
109
|
-
type: Number,
|
|
110
|
-
default: 5,
|
|
111
|
-
validator(value) {
|
|
112
|
-
return [5, 7, 9, 11, 13, 15, 17, 19, 21].includes(value);
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
size: {
|
|
116
|
-
type: String,
|
|
117
|
-
default: 'md',
|
|
118
|
-
validator(value) {
|
|
119
|
-
return ['sm', 'md', 'lg'].includes(value);
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
position: {
|
|
123
|
-
type: String,
|
|
124
|
-
default: 'start',
|
|
125
|
-
validator(value) {
|
|
126
|
-
return ['start', 'center', 'end'].includes(value);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
const navClass = computed(() => {
|
|
132
|
-
if (props.position === 'start') return null;
|
|
133
|
-
return `justify-content-${props.position}`;
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
const paginationClass = computed(() => {
|
|
137
|
-
if (props.size === 'md') return null;
|
|
138
|
-
return `pagination-${props.size}`;
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
const totalClass = computed(() => {
|
|
142
|
-
if (props.size === 'md') return null;
|
|
143
|
-
if (props.size === 'sm') return 'small';
|
|
144
|
-
if (props.size === 'lg') return 'fs-5';
|
|
145
|
-
return null;
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
const pageSizeClass = computed(() => {
|
|
149
|
-
if (props.size === 'md') return null;
|
|
150
|
-
return `form-select-${props.size}`;
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
const pageGoClass = computed(() => {
|
|
154
|
-
if (props.size === 'md') return null;
|
|
155
|
-
return `input-group-${props.size}`;
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
const pages = computed(() => {
|
|
159
|
-
return Math.ceil(props.total / props.pageSize);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
const showPrevMore = ref(false);
|
|
163
|
-
const showNextMore = ref(false);
|
|
164
|
-
|
|
165
|
-
const pagerCount = props.pagerCount;
|
|
166
|
-
const pagers = computed(() => {
|
|
167
|
-
const halfPagerCount = (pagerCount - 1) / 2;
|
|
168
|
-
const currentPage = props.currentPage;
|
|
169
|
-
const pageCount = pages.value;
|
|
170
|
-
let prevMore = false;
|
|
171
|
-
let nextMore = false;
|
|
172
|
-
if (pageCount > pagerCount) {
|
|
173
|
-
if (currentPage > pagerCount - halfPagerCount) {
|
|
174
|
-
prevMore = true;
|
|
175
|
-
}
|
|
176
|
-
if (currentPage < pageCount - halfPagerCount) {
|
|
177
|
-
nextMore = true;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
const array = [];
|
|
181
|
-
if (prevMore && !nextMore) {
|
|
182
|
-
const startPage = pageCount - (pagerCount - 2);
|
|
183
|
-
for (let i = startPage; i < pageCount; i++) {
|
|
184
|
-
array.push(i);
|
|
185
|
-
}
|
|
186
|
-
} else if (!prevMore && nextMore) {
|
|
187
|
-
for (let i = 2; i < pagerCount; i++) {
|
|
188
|
-
array.push(i);
|
|
189
|
-
}
|
|
190
|
-
} else if (prevMore && nextMore) {
|
|
191
|
-
const offset = Math.floor(pagerCount / 2) - 1;
|
|
192
|
-
for (let i = currentPage - offset; i <= currentPage + offset; i++) {
|
|
193
|
-
array.push(i);
|
|
194
|
-
}
|
|
195
|
-
} else {
|
|
196
|
-
for (let i = 2; i < pageCount; i++) {
|
|
197
|
-
array.push(i);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return array;
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
watchEffect(() => {
|
|
204
|
-
const halfPagerCount = (pagerCount - 1) / 2;
|
|
205
|
-
showPrevMore.value = false;
|
|
206
|
-
showNextMore.value = false;
|
|
207
|
-
if (pages.value > pagerCount) {
|
|
208
|
-
if (props.currentPage > pagerCount - halfPagerCount) {
|
|
209
|
-
showPrevMore.value = true;
|
|
210
|
-
}
|
|
211
|
-
if (props.currentPage < pages.value - halfPagerCount) {
|
|
212
|
-
showNextMore.value = true;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
</script>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import ScrollSpy from 'bootstrap/js/dist/scrollspy';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
mounted(el, binding) {
|
|
5
|
-
const target = el.getAttribute('data-bs-target');
|
|
6
|
-
const targetEl = document.querySelector(target);
|
|
7
|
-
new ScrollSpy(binding.modifiers.self ? el : document.body, {
|
|
8
|
-
target: targetEl,
|
|
9
|
-
smoothScroll: binding.modifiers.self ? true : false,
|
|
10
|
-
threshold: [0.1, 0.5, 1]
|
|
11
|
-
});
|
|
12
|
-
},
|
|
13
|
-
beforeUnmount(el, binding) {
|
|
14
|
-
ScrollSpy.getInstance(binding.modifiers.self ? el : document.body).dispose();
|
|
15
|
-
}
|
|
16
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<template></template>
|
|
2
|
-
<script setup>
|
|
3
|
-
import { inject, onMounted, onBeforeUnmount, useId } from 'vue';
|
|
4
|
-
import { cols_injection_key, tr_keyinfo_injection_key } from './table-keys.js';
|
|
5
|
-
|
|
6
|
-
const props = defineProps({
|
|
7
|
-
header: {
|
|
8
|
-
type: String,
|
|
9
|
-
default: null
|
|
10
|
-
},
|
|
11
|
-
field: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: null
|
|
14
|
-
},
|
|
15
|
-
type: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: null,
|
|
18
|
-
validator(value) {
|
|
19
|
-
if (value === null) return true;
|
|
20
|
-
return ['index', 'checkbox', 'radio', 'expand'].includes(value);
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
width: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: 'auto'
|
|
26
|
-
},
|
|
27
|
-
sortable: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: null,
|
|
30
|
-
validator(value) {
|
|
31
|
-
if (value === null) return true;
|
|
32
|
-
return ['local', 'remote'].includes(value);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const cols = inject(cols_injection_key);
|
|
38
|
-
const trKeyinfo = inject(tr_keyinfo_injection_key);
|
|
39
|
-
const key_id = useId();
|
|
40
|
-
onMounted(() => {
|
|
41
|
-
const col = {
|
|
42
|
-
key_id: key_id,
|
|
43
|
-
header: props.header,
|
|
44
|
-
field: props.field,
|
|
45
|
-
type: props.type,
|
|
46
|
-
width: props.width,
|
|
47
|
-
sortable: props.sortable
|
|
48
|
-
};
|
|
49
|
-
cols.push(col);
|
|
50
|
-
|
|
51
|
-
if (props.type === 'checkbox' || props.type === 'radio' || props.type === 'expand') {
|
|
52
|
-
trKeyinfo.type = props.type;
|
|
53
|
-
trKeyinfo.field = props.field;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
onBeforeUnmount(() => {
|
|
58
|
-
const index = cols.findIndex((item) => item.key_id === key_id);
|
|
59
|
-
cols.splice(index, 1);
|
|
60
|
-
});
|
|
61
|
-
</script>
|