@viewerplate/fontawesome 1.0.3
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 +0 -0
- package/components/index.d.ts +11 -0
- package/components/viewer/Viewer.vue +210 -0
- package/components/viewer/components/Item.vue +27 -0
- package/components/viewer/components/SubItem.vue +40 -0
- package/components/viewer/functions/index.ts +15 -0
- package/components/viewer/functions/route.ts +32 -0
- package/components/viewer/models/models.ts +12 -0
- package/dist/index.amd.ts +562 -0
- package/dist/index.cjs.ts +562 -0
- package/dist/style.css +62 -0
- package/package.json +56 -0
- package/tsconfig.json +52 -0
- package/vite.config.js +44 -0
- package/vue.config.js +51 -0
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! @licence MIT */
|
|
2
|
+
export { default as ViewerPlate } from "./viewer/Viewer.vue";
|
|
3
|
+
/*!
|
|
4
|
+
* Element plus v2.13.0 by elementplus - https://element-plus.org/
|
|
5
|
+
* Licensed under the MIT License (MIT), see LICENSE.
|
|
6
|
+
* Copyright 2025S Element plus Labs.
|
|
7
|
+
|
|
8
|
+
* Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com
|
|
9
|
+
* License - https://fontawesome.com/license/free - MIT License
|
|
10
|
+
* Copyright 2025 Fonticons, Inc.
|
|
11
|
+
*/
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex">
|
|
3
|
+
<div class="menu-background-color menu-border-bottom">
|
|
4
|
+
<div class="flex menu-border-right menu-button" @click="open(isCollapse, $event)">
|
|
5
|
+
<FontAwesomeIcon v-if="menuIcon" class="custom-color" :icon="menuIcon" />
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="flex justify-between menu-border-bottom w-100">
|
|
9
|
+
<div class="title-padding">
|
|
10
|
+
<h2 v-if="name != null" class="regular-color">{{name}}</h2>
|
|
11
|
+
<img v-if="logoUrl != null" class="logo" :src="logoUrl"></img>
|
|
12
|
+
</div>
|
|
13
|
+
<el-menu
|
|
14
|
+
class="el-menu-demo"
|
|
15
|
+
:default-active="activeIndex"
|
|
16
|
+
:mode="mode"
|
|
17
|
+
:ellipsis="ellipsis"
|
|
18
|
+
@select="handleSelect">
|
|
19
|
+
<template v-for="( item, index ) in TopItems">
|
|
20
|
+
<Item v-if="!item.items.length"
|
|
21
|
+
:index="'' + index"
|
|
22
|
+
:name="item.name" />
|
|
23
|
+
<SubItem v-else :index="'' + index"
|
|
24
|
+
:name="item.name"
|
|
25
|
+
:item="item"/>
|
|
26
|
+
</template>
|
|
27
|
+
</el-menu>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<el-row class="tac">
|
|
31
|
+
<el-col :span="1" class="v-menu-overlay">
|
|
32
|
+
<el-menu
|
|
33
|
+
class="el-menu-vertical-demo"
|
|
34
|
+
style="height: 100vh;"
|
|
35
|
+
:default-active="activeTopIndex"
|
|
36
|
+
:collapse="isCollapse"
|
|
37
|
+
@open="handleOpen"
|
|
38
|
+
@close="handleClose"
|
|
39
|
+
>
|
|
40
|
+
<template v-for="( item, index ) in LeftItems">
|
|
41
|
+
<Item v-if="!item.items.length"
|
|
42
|
+
:index="'' + index"
|
|
43
|
+
:item="item"
|
|
44
|
+
:name="item.name" />
|
|
45
|
+
<SubItem v-else :index="'' + index"
|
|
46
|
+
:name="item.name"
|
|
47
|
+
:item="item"/>
|
|
48
|
+
</template>
|
|
49
|
+
</el-menu>
|
|
50
|
+
</el-col>
|
|
51
|
+
<el-col :span="23"
|
|
52
|
+
v-loading="Loading"
|
|
53
|
+
:element-loading-text="loadingText"
|
|
54
|
+
:element-loading-background="bgRegular">
|
|
55
|
+
<slot name="handler"></slot>
|
|
56
|
+
</el-col>
|
|
57
|
+
</el-row>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script lang="ts">
|
|
61
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
62
|
+
import Item from './components/Item.vue';
|
|
63
|
+
import SubItem from './components/SubItem.vue';
|
|
64
|
+
import { Items, LeftItems } from './models/models';
|
|
65
|
+
import { load, router, Loading } from './functions/route';
|
|
66
|
+
import { ref } from 'vue';
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
components:{
|
|
70
|
+
Item: Item,
|
|
71
|
+
SubItem: SubItem,
|
|
72
|
+
FontAwesomeIcon: FontAwesomeIcon
|
|
73
|
+
},
|
|
74
|
+
props: {
|
|
75
|
+
LeftItems: {
|
|
76
|
+
type: Array as () => LeftItems[],
|
|
77
|
+
required: false
|
|
78
|
+
},
|
|
79
|
+
TopItems: {
|
|
80
|
+
type: Array as () => Items[],
|
|
81
|
+
required: false
|
|
82
|
+
},
|
|
83
|
+
logoUrl: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: false
|
|
86
|
+
},
|
|
87
|
+
name: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: false
|
|
90
|
+
},
|
|
91
|
+
colors: {
|
|
92
|
+
type: Object as () => {
|
|
93
|
+
textColor: string
|
|
94
|
+
activeTextColor: string
|
|
95
|
+
BgColor: string
|
|
96
|
+
},
|
|
97
|
+
required: true
|
|
98
|
+
},
|
|
99
|
+
menuIcon: {
|
|
100
|
+
type: null,
|
|
101
|
+
required: false
|
|
102
|
+
},
|
|
103
|
+
Router: {
|
|
104
|
+
type: null,
|
|
105
|
+
required: false
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
mounted() {
|
|
109
|
+
router(this.Router);
|
|
110
|
+
load(false);
|
|
111
|
+
},
|
|
112
|
+
data() {
|
|
113
|
+
return {
|
|
114
|
+
isCollapse: ref(true),
|
|
115
|
+
Loading: Loading,
|
|
116
|
+
activeIndex: ref('0'),
|
|
117
|
+
activeTopIndex: ref('0'),
|
|
118
|
+
bgColor: 'rgb(76, 135, 236);',
|
|
119
|
+
textColor: 'white',
|
|
120
|
+
bgRegular: 'rgb(76, 135, 236);',
|
|
121
|
+
mode: "horizontal",
|
|
122
|
+
ellipsis: false,
|
|
123
|
+
loadingText: "Loading...",
|
|
124
|
+
LeftItems: this.LeftItems,
|
|
125
|
+
TopItems: this.TopItems,
|
|
126
|
+
Router: this.Router,
|
|
127
|
+
colors: this.colors,
|
|
128
|
+
menuIcon: this.menuIcon
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
methods: {
|
|
132
|
+
handleOpen(key: string, keyPath: string[]) {
|
|
133
|
+
console.log(key, keyPath);
|
|
134
|
+
},
|
|
135
|
+
handleClose(key: string, keyPath: string[]) {
|
|
136
|
+
console.log(key, keyPath);
|
|
137
|
+
},
|
|
138
|
+
handleSelect(key: string, keyPath: string[]) {
|
|
139
|
+
console.log(key, keyPath);
|
|
140
|
+
},
|
|
141
|
+
open(value: boolean, event: any) {
|
|
142
|
+
this.isCollapse = !value;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<style>
|
|
150
|
+
.el-menu-vertical-demo:not(.el-menu--collapse) {
|
|
151
|
+
width: 200px;
|
|
152
|
+
min-height: 400px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.menu-background-color{
|
|
156
|
+
background-color: rgb(76, 135, 236);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.menu-border-bottom{
|
|
160
|
+
border-bottom: 1px solid #000000;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.menu-border-right{
|
|
164
|
+
border-right: 1px solid #fff;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.flex{
|
|
168
|
+
display: flex;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.justify-between{
|
|
172
|
+
justify-content: space-between;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.w-100{
|
|
176
|
+
width: 100%;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.custom-color{
|
|
180
|
+
color: #eaeaea
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.regular-color{
|
|
184
|
+
color: rgb(76, 135, 236);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.menu-button{
|
|
188
|
+
width: 64px;
|
|
189
|
+
height: 64px;
|
|
190
|
+
justify-content: center;
|
|
191
|
+
align-items: center;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.logo{
|
|
195
|
+
width: 64px;
|
|
196
|
+
height: 64px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.title-padding{
|
|
200
|
+
padding: 10px 10px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.v-menu-overlay{
|
|
204
|
+
z-index: 99999;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.el-loading-spinner circle{
|
|
208
|
+
stroke-width: 5px !important;
|
|
209
|
+
}
|
|
210
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { LeftItems, Items } from '../models/models';
|
|
3
|
+
import { setIndex } from './../functions/index';
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
5
|
+
import { toTop, to } from './../functions/route';
|
|
6
|
+
|
|
7
|
+
const defaults = defineProps<{
|
|
8
|
+
name: string,
|
|
9
|
+
index: string,
|
|
10
|
+
item?: LeftItems | Items;
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const item: LeftItems = defaults.item as LeftItems;
|
|
14
|
+
const topItem: Items = defaults.item as Items;
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<el-menu-item :index="setIndex(defaults.index)"
|
|
19
|
+
@click="() => item ? to(item.path) : toTop(topItem.path)">
|
|
20
|
+
<el-icon v-if="item"><FontAwesomeIcon v-if="item.icon" :icon="item.icon" /></el-icon>
|
|
21
|
+
<template #title>{{name}}</template>
|
|
22
|
+
<slot :name="defaults.name"></slot>
|
|
23
|
+
</el-menu-item>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style scoped>
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { setIndex } from './../functions/index';
|
|
3
|
+
import { toTop, to } from './../functions/route';
|
|
4
|
+
import { Items, LeftItems } from './../models/models';
|
|
5
|
+
import Item from './Item.vue';
|
|
6
|
+
import SubItem from './SubItem.vue';
|
|
7
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
8
|
+
|
|
9
|
+
const defaults = defineProps<{
|
|
10
|
+
name: string,
|
|
11
|
+
index: string,
|
|
12
|
+
item: Items | LeftItems
|
|
13
|
+
}>()
|
|
14
|
+
const item: LeftItems = defaults.item as LeftItems;
|
|
15
|
+
const topItem: Items = defaults.item as Items;
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<el-sub-menu :index="setIndex(index)" >
|
|
20
|
+
<template #title
|
|
21
|
+
@click="() => item ? to(item.path) : toTop(topItem.path)">
|
|
22
|
+
<el-icon v-if="item.icon"><FontAwesomeIcon v-if="item.icon" :icon="item.icon" /></el-icon>
|
|
23
|
+
<span>{{ name }}</span>
|
|
24
|
+
</template>
|
|
25
|
+
<el-item-group v-for="( subItem, subIndex ) in item.items">
|
|
26
|
+
<Item v-if="!subItem.items.length"
|
|
27
|
+
@click="toTop(subItem.path)"
|
|
28
|
+
:index="'' + index + ':' + subIndex"
|
|
29
|
+
:name="subItem.name"
|
|
30
|
+
:item="subItem"/>
|
|
31
|
+
<SubItem v-else
|
|
32
|
+
:index="setIndex('' + index + ':' + subIndex)"
|
|
33
|
+
:name="subItem.name"
|
|
34
|
+
:item="subItem"/>
|
|
35
|
+
</el-item-group>
|
|
36
|
+
</el-sub-menu>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const setIndex = (index: string) => {
|
|
2
|
+
let counter = 1;
|
|
3
|
+
let parts = index.split(':');
|
|
4
|
+
let value = '' + (parts[0] + counter);
|
|
5
|
+
|
|
6
|
+
if(parts.length > 1){
|
|
7
|
+
value += "-" + (parts[1] + counter);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if(parts.length > 2){
|
|
11
|
+
value += "-" + (parts[2] + counter);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return index;
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
let Router: any;
|
|
2
|
+
export let Loading: any;
|
|
3
|
+
|
|
4
|
+
export const router = (router: any) => {
|
|
5
|
+
Router = router;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const load = (loading: any) => {
|
|
9
|
+
Loading = loading;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const to = (path: string) => {
|
|
13
|
+
if(Router != null){
|
|
14
|
+
Loading = true;
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
Router.push({ path: `${path}` }).finally(() => {
|
|
17
|
+
Loading = false;
|
|
18
|
+
});
|
|
19
|
+
}, 400)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const toTop = (path: string) => {
|
|
24
|
+
if(Router != null){
|
|
25
|
+
Loading = true;
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
Router.push({ path: `${path}` }).finally(() => {
|
|
28
|
+
Loading = false;
|
|
29
|
+
});
|
|
30
|
+
}, 400)
|
|
31
|
+
}
|
|
32
|
+
}
|