bootstrap-vue-top 1.0.13 → 1.0.14
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,92 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="toast-container position-fixed p-3" :class="containerClass">
|
|
3
|
-
<div ref="toastRef" class="toast" role="alert" aria-live="polite" aria-atomic="true">
|
|
4
|
-
<div class="toast-header">
|
|
5
|
-
<BiCheckCircleFill v-if="type === 'success'" class="fs-6 text-success" />
|
|
6
|
-
<BiXCircleFill v-else-if="type === 'danger'" class="fs-6 text-danger" />
|
|
7
|
-
<BiExclamationCircleFill v-else-if="type === 'warning'" class="fs-6 text-warning" />
|
|
8
|
-
<BiInfoCircleFill v-else class="fs-6 text-info" />
|
|
9
|
-
<strong class="ms-2 me-auto">{{ title }}</strong>
|
|
10
|
-
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="toast-body" v-html="message"></div>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<script setup>
|
|
19
|
-
import { shallowRef, onMounted, onBeforeUnmount, computed } from 'vue';
|
|
20
|
-
import Toast from 'bootstrap/js/dist/toast';
|
|
21
|
-
|
|
22
|
-
const emit = defineEmits(['destroy']);
|
|
23
|
-
|
|
24
|
-
const toastRef = shallowRef(null);
|
|
25
|
-
const props = defineProps({
|
|
26
|
-
type: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: 'info',
|
|
29
|
-
validator(value) {
|
|
30
|
-
return ['success', 'danger', 'warning', 'info'].includes(value);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
title: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: 'Toast'
|
|
36
|
-
},
|
|
37
|
-
message: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: 'Toast message'
|
|
40
|
-
},
|
|
41
|
-
duration: {
|
|
42
|
-
type: Number,
|
|
43
|
-
default: 5000
|
|
44
|
-
},
|
|
45
|
-
position: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: 'top-right',
|
|
48
|
-
validator(value) {
|
|
49
|
-
return ['top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left'].includes(value);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const containerClass = computed(() => {
|
|
55
|
-
if (props.position === 'top-right') {
|
|
56
|
-
return 'top-0 end-0';
|
|
57
|
-
} else if (props.position === 'top-left') {
|
|
58
|
-
return 'top-0 start-0';
|
|
59
|
-
} else if (props.position === 'top-center') {
|
|
60
|
-
return 'top-0 start-50 translate-middle-x';
|
|
61
|
-
} else if (props.position === 'bottom-right') {
|
|
62
|
-
return 'bottom-0 end-0';
|
|
63
|
-
} else if (props.position === 'bottom-left') {
|
|
64
|
-
return 'bottom-0 start-0';
|
|
65
|
-
} else {
|
|
66
|
-
return 'top-0 end-0';
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
let toast = null;
|
|
71
|
-
onMounted(() => {
|
|
72
|
-
if (toast === null) {
|
|
73
|
-
toast = new Toast(toastRef.value, {
|
|
74
|
-
autohide: props.duration === 0 ? false : true,
|
|
75
|
-
delay: props.duration
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
toastRef.value.addEventListener('hidden.bs.toast', () => {
|
|
79
|
-
emit('destroy');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
toast.show();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
onBeforeUnmount(() => {
|
|
87
|
-
if (toast !== null) {
|
|
88
|
-
toast.dispose();
|
|
89
|
-
toast = null;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
</script>
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<li>
|
|
3
|
-
<div class="node" :style="{ 'padding-left': level + 'rem' }">
|
|
4
|
-
<a
|
|
5
|
-
v-if="isFolder"
|
|
6
|
-
href="#"
|
|
7
|
-
@click.prevent="toggle"
|
|
8
|
-
class="link-body-emphasis node-switcher"
|
|
9
|
-
:class="{ 'rotate-90': isExpand }"
|
|
10
|
-
>
|
|
11
|
-
<BiCaretRight />
|
|
12
|
-
</a>
|
|
13
|
-
<div v-else class="node-placeholder"></div>
|
|
14
|
-
<div class="node-content">
|
|
15
|
-
<template v-if="mode === 'base'">
|
|
16
|
-
<a href="#" class="node-content_link focus-ring p-1" @click.prevent="handleNodeClick(data[attrs.key])">{{
|
|
17
|
-
data[attrs.label]
|
|
18
|
-
}}</a>
|
|
19
|
-
</template>
|
|
20
|
-
<template v-else-if="mode === 'checkbox'">
|
|
21
|
-
<div class="p-1">
|
|
22
|
-
<input
|
|
23
|
-
class="form-check-input"
|
|
24
|
-
type="checkbox"
|
|
25
|
-
:value="data[attrs.key]"
|
|
26
|
-
:id="boxId"
|
|
27
|
-
v-model="checkboxSelectedKeys"
|
|
28
|
-
/>
|
|
29
|
-
<label class="form-check-label px-2" :for="boxId">
|
|
30
|
-
{{ data[attrs.label] }}
|
|
31
|
-
</label>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
<template v-else-if="mode === 'radio'">
|
|
35
|
-
<div class="p-1">
|
|
36
|
-
<input
|
|
37
|
-
class="form-check-input"
|
|
38
|
-
type="radio"
|
|
39
|
-
:value="data[attrs.key]"
|
|
40
|
-
:id="boxId"
|
|
41
|
-
v-model="radioSelectedKey"
|
|
42
|
-
/>
|
|
43
|
-
<label class="form-check-label px-2" :for="boxId">
|
|
44
|
-
{{ data[attrs.label] }}
|
|
45
|
-
</label>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
<template v-if="isFolder">
|
|
51
|
-
<ul v-show="isExpand" class="list-unstyled">
|
|
52
|
-
<TreeNode v-for="data in data[attrs.children]" :data="data" :level="level + 1" :key="data[attrs.key]" />
|
|
53
|
-
</ul>
|
|
54
|
-
</template>
|
|
55
|
-
</li>
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<script setup>
|
|
59
|
-
import { ref, computed, inject, useId } from 'vue';
|
|
60
|
-
import {
|
|
61
|
-
attrs_key,
|
|
62
|
-
mode_key,
|
|
63
|
-
expand_level_key,
|
|
64
|
-
radio_selected_Key,
|
|
65
|
-
checkbox_selected_keys,
|
|
66
|
-
node_click_key
|
|
67
|
-
} from './tree-keys.js';
|
|
68
|
-
|
|
69
|
-
const props = defineProps({
|
|
70
|
-
data: {
|
|
71
|
-
type: Object,
|
|
72
|
-
required: true
|
|
73
|
-
},
|
|
74
|
-
level: {
|
|
75
|
-
type: Number,
|
|
76
|
-
default: 0
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const mode = inject(mode_key);
|
|
81
|
-
const expandLevel = inject(expand_level_key);
|
|
82
|
-
const radioSelectedKey = inject(radio_selected_Key);
|
|
83
|
-
const checkboxSelectedKeys = inject(checkbox_selected_keys);
|
|
84
|
-
const attrs = inject(attrs_key);
|
|
85
|
-
const handleNodeClick = inject(node_click_key);
|
|
86
|
-
|
|
87
|
-
const isExpand = ref(props.level < expandLevel + 1);
|
|
88
|
-
const isFolder = computed(() => {
|
|
89
|
-
return props.data[attrs.children] && props.data[attrs.children].length;
|
|
90
|
-
});
|
|
91
|
-
function toggle() {
|
|
92
|
-
isExpand.value = !isExpand.value;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
let boxId = null;
|
|
96
|
-
if (mode === 'checkbox' || mode === 'radio') {
|
|
97
|
-
boxId = useId();
|
|
98
|
-
}
|
|
99
|
-
</script>
|
|
100
|
-
|
|
101
|
-
<style scoped>
|
|
102
|
-
.node {
|
|
103
|
-
display: flex;
|
|
104
|
-
align-items: center;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.node-switcher {
|
|
108
|
-
flex-grow: 0;
|
|
109
|
-
flex-shrink: 0;
|
|
110
|
-
transition: transform 0.3s ease;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.node-switcher.rotate-90 {
|
|
114
|
-
transform: rotate(90deg);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.node-placeholder {
|
|
118
|
-
flex-grow: 0;
|
|
119
|
-
flex-shrink: 0;
|
|
120
|
-
width: 1rem;
|
|
121
|
-
height: 1px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.node-content {
|
|
125
|
-
flex-grow: 0;
|
|
126
|
-
flex-shrink: 0;
|
|
127
|
-
margin-left: 0.125rem;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.node-content_link {
|
|
131
|
-
display: block;
|
|
132
|
-
color: var(--bs-body-color);
|
|
133
|
-
text-decoration: none;
|
|
134
|
-
border-radius: var(--bs-border-radius);
|
|
135
|
-
white-space: nowrap;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
text-overflow: ellipsis;
|
|
138
|
-
max-width: 15rem;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.node-content_link:hover {
|
|
142
|
-
background-color: var(--bs-secondary-bg);
|
|
143
|
-
}
|
|
144
|
-
</style>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul class="list-unstyled">
|
|
3
|
-
<TreeItem :data="data"></TreeItem>
|
|
4
|
-
</ul>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup>
|
|
8
|
-
import { provide, ref, watch } from 'vue';
|
|
9
|
-
import TreeItem from './tree-node.vue';
|
|
10
|
-
import {
|
|
11
|
-
attrs_key,
|
|
12
|
-
mode_key,
|
|
13
|
-
expand_level_key,
|
|
14
|
-
radio_selected_Key,
|
|
15
|
-
checkbox_selected_keys,
|
|
16
|
-
node_click_key
|
|
17
|
-
} from './tree-keys.js';
|
|
18
|
-
|
|
19
|
-
const emit = defineEmits(['node-click', 'radio-change', 'checkbox-change']);
|
|
20
|
-
|
|
21
|
-
const props = defineProps({
|
|
22
|
-
data: {
|
|
23
|
-
type: Object,
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
mode: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: 'base',
|
|
29
|
-
validator(value) {
|
|
30
|
-
return ['base', 'checkbox', 'radio'].includes(value);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
expandLevel: {
|
|
34
|
-
type: Number,
|
|
35
|
-
default: 0
|
|
36
|
-
},
|
|
37
|
-
attrKey: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: true
|
|
40
|
-
},
|
|
41
|
-
attrLabel: {
|
|
42
|
-
type: String,
|
|
43
|
-
required: true
|
|
44
|
-
},
|
|
45
|
-
attrChildren: {
|
|
46
|
-
type: String,
|
|
47
|
-
required: true
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
provide(mode_key, props.mode);
|
|
52
|
-
provide(expand_level_key, props.expandLevel);
|
|
53
|
-
|
|
54
|
-
const radioSelectedKey = ref(null);
|
|
55
|
-
provide(radio_selected_Key, radioSelectedKey);
|
|
56
|
-
const checkboxSelectedKeys = ref([]);
|
|
57
|
-
|
|
58
|
-
provide(checkbox_selected_keys, checkboxSelectedKeys);
|
|
59
|
-
provide(attrs_key, {
|
|
60
|
-
key: props.attrKey,
|
|
61
|
-
label: props.attrLabel,
|
|
62
|
-
children: props.attrChildren
|
|
63
|
-
});
|
|
64
|
-
provide(node_click_key, handleNodeClick);
|
|
65
|
-
|
|
66
|
-
function handleNodeClick(key) {
|
|
67
|
-
emit('node-click', key);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
watch(radioSelectedKey, (newKey) => {
|
|
71
|
-
emit('radio-change', newKey);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
watch(checkboxSelectedKeys, (newKeys) => {
|
|
75
|
-
emit('checkbox-change', newKeys);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
defineExpose({
|
|
79
|
-
getCheckboxSelectedKeys: function () {
|
|
80
|
-
return checkboxSelectedKeys.value;
|
|
81
|
-
},
|
|
82
|
-
setCheckboxSelectedKeys: function (val) {
|
|
83
|
-
checkboxSelectedKeys.value = val;
|
|
84
|
-
},
|
|
85
|
-
getRadioSelectedKey: function () {
|
|
86
|
-
return radioSelectedKey.value;
|
|
87
|
-
},
|
|
88
|
-
setRadioSelectedKey: function (val) {
|
|
89
|
-
radioSelectedKey.value = val;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
</script>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<template></template>
|
|
2
|
-
<script setup>
|
|
3
|
-
import { inject, onMounted, onBeforeUnmount, useId } from 'vue';
|
|
4
|
-
import { cols_key } from './treetable-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
|
-
width: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: 'auto'
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const cols = inject(cols_key);
|
|
22
|
-
const keyId = useId();
|
|
23
|
-
onMounted(() => {
|
|
24
|
-
const col = {
|
|
25
|
-
keyId: keyId,
|
|
26
|
-
header: props.header,
|
|
27
|
-
field: props.field,
|
|
28
|
-
width: props.width
|
|
29
|
-
};
|
|
30
|
-
cols.push(col);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
onBeforeUnmount(() => {
|
|
34
|
-
const index = cols.findIndex((item) => item.keyId === keyId);
|
|
35
|
-
cols.splice(index, 1);
|
|
36
|
-
});
|
|
37
|
-
</script>
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<tr>
|
|
3
|
-
<template v-for="(col, index) in cols">
|
|
4
|
-
<td v-if="index === 0">
|
|
5
|
-
<div class="node" :style="{ 'padding-left': level + 'rem' }">
|
|
6
|
-
<a
|
|
7
|
-
v-if="isFolder"
|
|
8
|
-
href="#"
|
|
9
|
-
role="button"
|
|
10
|
-
@click.prevent="toggle"
|
|
11
|
-
class="link-body-emphasis node-switcher"
|
|
12
|
-
:class="{ 'rotate-90': isExpand }"
|
|
13
|
-
>
|
|
14
|
-
<BiCaretRight />
|
|
15
|
-
</a>
|
|
16
|
-
<div v-else class="node-placeholder"></div>
|
|
17
|
-
<div class="node-content">
|
|
18
|
-
<template v-if="col.body === null">
|
|
19
|
-
{{ get(data, col.field) }}
|
|
20
|
-
</template>
|
|
21
|
-
<component v-else :is="col.body" :item="data" />
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</td>
|
|
25
|
-
<td v-else>
|
|
26
|
-
<template v-if="col.body === null">
|
|
27
|
-
{{ get(data, col.field) }}
|
|
28
|
-
</template>
|
|
29
|
-
<component v-else :is="col.body" :item="data" />
|
|
30
|
-
</td>
|
|
31
|
-
</template>
|
|
32
|
-
</tr>
|
|
33
|
-
<template v-if="isExpand && isFolder">
|
|
34
|
-
<TreetableNode v-for="data in data[attrs.children]" :data="data" :level="level + 1" :key="data[attrs.key]" />
|
|
35
|
-
</template>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<script setup>
|
|
39
|
-
import { computed, inject } from 'vue';
|
|
40
|
-
import { get } from 'lodash-es';
|
|
41
|
-
import { cols_key, attrs_key, expand_keys } from './treetable-keys.js';
|
|
42
|
-
|
|
43
|
-
const props = defineProps({
|
|
44
|
-
data: {
|
|
45
|
-
type: Object,
|
|
46
|
-
required: true
|
|
47
|
-
},
|
|
48
|
-
level: {
|
|
49
|
-
type: Number,
|
|
50
|
-
default: 0
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const cols = inject(cols_key);
|
|
55
|
-
const attrs = inject(attrs_key);
|
|
56
|
-
const expandKeys = inject(expand_keys);
|
|
57
|
-
|
|
58
|
-
const key = props.data[attrs.key];
|
|
59
|
-
|
|
60
|
-
const isExpand = computed(() => {
|
|
61
|
-
return expandKeys.value[key] === true;
|
|
62
|
-
});
|
|
63
|
-
const isFolder = computed(() => {
|
|
64
|
-
return props.data[attrs.children] && props.data[attrs.children].length;
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
function toggle() {
|
|
68
|
-
if (expandKeys.value[key]) {
|
|
69
|
-
expandKeys.value[key] = false;
|
|
70
|
-
} else {
|
|
71
|
-
expandKeys.value[key] = true;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<style scoped>
|
|
77
|
-
.node {
|
|
78
|
-
display: flex;
|
|
79
|
-
align-items: center;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.node-switcher {
|
|
83
|
-
flex-grow: 0;
|
|
84
|
-
flex-shrink: 0;
|
|
85
|
-
transition: transform 0.3s;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.node-switcher.rotate-90 {
|
|
89
|
-
transform: rotate(90deg);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.node-placeholder {
|
|
93
|
-
flex-grow: 0;
|
|
94
|
-
flex-shrink: 0;
|
|
95
|
-
width: 1rem;
|
|
96
|
-
height: 1px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.node-content {
|
|
100
|
-
flex-grow: 0;
|
|
101
|
-
flex-shrink: 0;
|
|
102
|
-
margin-left: 0.25rem;
|
|
103
|
-
}
|
|
104
|
-
</style>
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<table class="table" :class="tableClass">
|
|
3
|
-
<caption v-if="caption">
|
|
4
|
-
{{
|
|
5
|
-
caption
|
|
6
|
-
}}
|
|
7
|
-
</caption>
|
|
8
|
-
<slot></slot>
|
|
9
|
-
<template v-if="ready">
|
|
10
|
-
<colgroup>
|
|
11
|
-
<template v-for="col in cols">
|
|
12
|
-
<col :style="{ width: col.width }" />
|
|
13
|
-
</template>
|
|
14
|
-
</colgroup>
|
|
15
|
-
<thead :class="theadClass">
|
|
16
|
-
<tr>
|
|
17
|
-
<template v-for="col in cols">
|
|
18
|
-
<th scope="col">
|
|
19
|
-
{{ col.header }}
|
|
20
|
-
</th>
|
|
21
|
-
</template>
|
|
22
|
-
</tr>
|
|
23
|
-
</thead>
|
|
24
|
-
<tbody :class="tbodyClass">
|
|
25
|
-
<TreetableNode :data="data"></TreetableNode>
|
|
26
|
-
</tbody>
|
|
27
|
-
<tfoot :class="tfootClass" v-if="tfootData !== null">
|
|
28
|
-
<tr>
|
|
29
|
-
<td v-for="item in tfootData">{{ item }}</td>
|
|
30
|
-
</tr>
|
|
31
|
-
</tfoot>
|
|
32
|
-
</template>
|
|
33
|
-
</table>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script setup>
|
|
37
|
-
import { useSlots, ref, provide, onMounted } from 'vue';
|
|
38
|
-
import { cols_key, attrs_key, expand_keys } from './treetable-keys.js';
|
|
39
|
-
import TreetableNode from './treetable-node.vue';
|
|
40
|
-
|
|
41
|
-
const props = defineProps({
|
|
42
|
-
data: {
|
|
43
|
-
type: Object,
|
|
44
|
-
required: true
|
|
45
|
-
},
|
|
46
|
-
tableClass: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: null
|
|
49
|
-
},
|
|
50
|
-
theadClass: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: null
|
|
53
|
-
},
|
|
54
|
-
tbodyClass: {
|
|
55
|
-
type: String,
|
|
56
|
-
default: null
|
|
57
|
-
},
|
|
58
|
-
tfootClass: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: null
|
|
61
|
-
},
|
|
62
|
-
tfootData: {
|
|
63
|
-
type: Array,
|
|
64
|
-
default: null
|
|
65
|
-
},
|
|
66
|
-
attrKey: {
|
|
67
|
-
type: String,
|
|
68
|
-
required: true
|
|
69
|
-
},
|
|
70
|
-
attrChildren: {
|
|
71
|
-
type: String,
|
|
72
|
-
required: true
|
|
73
|
-
},
|
|
74
|
-
caption: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: null
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const ready = ref(false);
|
|
81
|
-
|
|
82
|
-
const cols = [];
|
|
83
|
-
provide(cols_key, cols);
|
|
84
|
-
provide(attrs_key, { key: props.attrKey, children: props.attrChildren });
|
|
85
|
-
const expandKeys = ref({});
|
|
86
|
-
expandKeys.value[props.data[props.attrKey]] = true;
|
|
87
|
-
provide(expand_keys, expandKeys);
|
|
88
|
-
|
|
89
|
-
onMounted(() => {
|
|
90
|
-
_initCols();
|
|
91
|
-
|
|
92
|
-
ready.value = true;
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
function _initCols() {
|
|
96
|
-
const slots = useSlots();
|
|
97
|
-
const vNodes = slots.default();
|
|
98
|
-
|
|
99
|
-
const colVNodes = [];
|
|
100
|
-
for (const vNode of vNodes) {
|
|
101
|
-
if (vNode.type.__name === 'treetable-col') {
|
|
102
|
-
colVNodes.push(vNode);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
for (let i = 0; i < cols.length; i++) {
|
|
107
|
-
if (colVNodes[i].children !== null && colVNodes[i].children.body !== 'undefined') {
|
|
108
|
-
cols[i].body = colVNodes[i].children.body;
|
|
109
|
-
} else {
|
|
110
|
-
cols[i].body = null;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
</script>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="elementRef">
|
|
3
|
-
<slot name="trigger"></slot>
|
|
4
|
-
<slot v-if="$slots.tip" name="tip"></slot>
|
|
5
|
-
<ul v-if="fileList.length > 0" class="list-unstyled mb-0">
|
|
6
|
-
<li v-for="(file, index) in fileList" class="d-flex align-items-center border-bottom py-2">
|
|
7
|
-
<span class="me-3">{{ index + 1 }}. {{ file.name }}</span>
|
|
8
|
-
<small class="text-body-secondary me-3 d-none d-sm-block">[{{ formatFileSize(file.size) }}]</small>
|
|
9
|
-
<a class="ms-auto me-3" :href="file.url" target="_blank"><bi-eye /></a>
|
|
10
|
-
<a href="#" @click.prevent="handleRemove(index)"><bi-x-lg /></a>
|
|
11
|
-
</li>
|
|
12
|
-
</ul>
|
|
13
|
-
<input ref="fileRef" type="file" :multiple="multiple" name="file" style="display: none" @change="handleChange" />
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<script setup>
|
|
19
|
-
import { shallowRef, onMounted } from 'vue';
|
|
20
|
-
const emit = defineEmits(['file-change', 'file-remove']);
|
|
21
|
-
|
|
22
|
-
const props = defineProps({
|
|
23
|
-
fileList: {
|
|
24
|
-
type: Array,
|
|
25
|
-
default: []
|
|
26
|
-
},
|
|
27
|
-
multiple: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const elementRef = shallowRef(null);
|
|
34
|
-
const fileRef = shallowRef(null);
|
|
35
|
-
|
|
36
|
-
onMounted(() => {
|
|
37
|
-
elementRef.value.children[0].addEventListener('click', function () {
|
|
38
|
-
fileRef.value.click();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
function handleChange(event) {
|
|
43
|
-
emit('file-change', event.target);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function handleRemove(index) {
|
|
47
|
-
emit('file-remove', index);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 格式化文件大小
|
|
52
|
-
* @param {number} bytes - 文件大小的字节数
|
|
53
|
-
* @param {number} [decimals=2] - 保留的小数位数,默认为 2
|
|
54
|
-
* @returns {string} 格式化后的文件大小
|
|
55
|
-
*/
|
|
56
|
-
function formatFileSize(bytes, decimals = 2) {
|
|
57
|
-
if (bytes === 0) return '0 Bytes';
|
|
58
|
-
|
|
59
|
-
const k = 1024;
|
|
60
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
61
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
62
|
-
|
|
63
|
-
// 保留指定小数位数
|
|
64
|
-
const size = parseFloat((bytes / Math.pow(k, i)).toFixed(decimals));
|
|
65
|
-
|
|
66
|
-
return `${size} ${sizes[i]}`;
|
|
67
|
-
}
|
|
68
|
-
</script>
|