@thestarweb/ui 1.4.2 → 1.5.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/build-ts/main.js +24 -4
- package/dist/star-ui.common.js +1494 -726
- package/dist/star-ui.common.js.map +1 -1
- package/dist/star-ui.umd.js +1494 -726
- package/dist/star-ui.umd.js.map +1 -1
- package/dist/star-ui.umd.min.js +71 -71
- package/dist/star-ui.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +2 -2
- package/src/components/button.vue +3 -3
- package/src/components/calendar.vue +3 -3
- package/src/components/call-render.tsx +4 -3
- package/src/components/card.vue +4 -4
- package/src/components/content/index.ts +1 -0
- package/src/components/content/page.vue +117 -0
- package/src/components/input.vue +3 -3
- package/src/components/layout-h.vue +3 -4
- package/src/components/layout-main.vue +3 -2
- package/src/components/layout-v.vue +3 -2
- package/src/components/line-h.vue +9 -8
- package/src/components/line-v.vue +9 -8
- package/src/components/menu/index.ts +1 -0
- package/src/components/menu/index.vue +83 -0
- package/src/components/menu/menu-h/index.vue +66 -0
- package/src/components/menu/menu-h/menu-h-child.vue +74 -0
- package/src/components/menu/menu-h/menu-h-item.vue +65 -0
- package/src/components/menu/menu-v/index.vue +56 -0
- package/src/components/select.vue +3 -3
- package/src/components/slider.vue +3 -3
- package/src/components/switch.vue +43 -43
- package/src/components/table.vue +3 -3
- package/src/components/tree/index.vue +3 -3
- package/src/components/tree/tree-item.vue +5 -4
- package/src/components/view-control.vue +3 -4
- package/src/directives/is-focus.ts +10 -0
- package/src/global-style.css +3 -0
- package/src/icon-font/iconfont.css +17 -7
- package/src/icon-font/iconfont.json +22 -1
- package/src/icon-font/iconfont.ttf +0 -0
- package/src/icon-font/iconfont.woff +0 -0
- package/src/icon-font/iconfont.woff2 +0 -0
- package/src/main.ts +36 -25
- package/src/reg.ts +26 -6
- package/src/types.d.ts +6 -0
- package/src/utils.ts +1 -1
- package/types/components/button.vue.d.ts +5 -0
- package/types/components/calendar.vue.d.ts +26 -0
- package/types/components/card.vue.d.ts +13 -0
- package/types/components/common/base-popper.vue.d.ts +19 -0
- package/types/components/content/index.d.ts +1 -0
- package/types/components/content/page.vue.d.ts +10 -0
- package/types/components/input.vue.d.ts +15 -0
- package/types/components/layout-h.vue.d.ts +4 -0
- package/types/components/layout-main.vue.d.ts +4 -0
- package/types/components/layout-v.vue.d.ts +4 -0
- package/types/components/line-h.vue.d.ts +4 -0
- package/types/components/line-v.vue.d.ts +4 -0
- package/types/components/menu/index.d.ts +1 -0
- package/types/components/menu/index.vue.d.ts +12 -0
- package/types/components/menu/menu-h/index.vue.d.ts +8 -0
- package/types/components/menu/menu-h/menu-h-child.vue.d.ts +7 -0
- package/types/components/menu/menu-h/menu-h-item.vue.d.ts +8 -0
- package/types/components/menu/menu-v/index.vue.d.ts +9 -0
- package/types/components/select.vue.d.ts +27 -0
- package/types/components/slider.vue.d.ts +29 -0
- package/types/components/switch.vue.d.ts +12 -0
- package/types/components/table.vue.d.ts +5 -0
- package/types/components/tree/index.vue.d.ts +15 -0
- package/types/components/tree/tree-item.vue.d.ts +18 -0
- package/types/components/view-control.vue.d.ts +15 -0
- package/types/directives/is-focus.d.ts +4 -0
- package/types/main.d.ts +68 -6
- package/types/reg.d.ts +14 -1
- package/dist/img/iconfont.ff1d7f50.svg +0 -62
- package/types/utils.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thestarweb/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "A UI lib",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "vue-cli-service build --target lib --name star-ui --dest dist/ src/main.ts",
|
|
7
|
-
"tsc": "node ./build-ts/main.js&&tsc
|
|
7
|
+
"tsc": "node ./build-ts/main.js&&tsc --p ./tsdconfig.json"
|
|
8
8
|
},
|
|
9
9
|
"author": "star_ss",
|
|
10
10
|
"bugs": {
|
package/readme.md
CHANGED
|
@@ -8,8 +8,8 @@ npm i @thestarweb/ui
|
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
-
import { createApp } from
|
|
12
|
-
import App from
|
|
11
|
+
import { createApp } from "vue"
|
|
12
|
+
import App from "./App.vue"
|
|
13
13
|
import StarUi from "@thestarweb/ui";
|
|
14
14
|
|
|
15
15
|
createApp(App).use(StarUi).mount('#app');
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import {
|
|
9
|
-
import { Prop } from "
|
|
8
|
+
import { Vue } from "vue-class-component";
|
|
9
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
10
10
|
|
|
11
11
|
import "../global-style.css";
|
|
12
12
|
|
|
13
|
-
@
|
|
13
|
+
@Register({
|
|
14
14
|
name:"su-button"
|
|
15
15
|
})
|
|
16
16
|
export default class SuButton extends Vue {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
54
|
<script lang="ts">
|
|
55
|
-
import {
|
|
56
|
-
import { Prop, Emit } from "
|
|
55
|
+
import { Vue } from "vue-class-component";
|
|
56
|
+
import { Register, Prop, Emit } from "@ui-root/reg";
|
|
57
57
|
import moment from "moment";
|
|
58
58
|
import CallRender from "./call-render";
|
|
59
59
|
|
|
@@ -69,7 +69,7 @@ interface DateBaseInfo{
|
|
|
69
69
|
date:moment.Moment;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
@
|
|
72
|
+
@Register({
|
|
73
73
|
name:"su-calendar",
|
|
74
74
|
components:{
|
|
75
75
|
vnodes: CallRender,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Prop } from "../reg";
|
|
1
|
+
import { Vue } from 'vue-class-component';
|
|
2
|
+
import { Prop, Register } from "../reg";
|
|
3
3
|
|
|
4
|
-
@
|
|
4
|
+
@Register({
|
|
5
5
|
name:'call-render',
|
|
6
|
+
internalOnly: true,
|
|
6
7
|
})
|
|
7
8
|
export default class CallRender extends Vue {
|
|
8
9
|
@Prop({
|
package/src/components/card.vue
CHANGED
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script lang="ts">
|
|
16
|
-
import {
|
|
17
|
-
import { Prop } from "
|
|
16
|
+
import { Vue } from 'vue-class-component';
|
|
17
|
+
import { Prop, Register } from "@ui-root/reg";
|
|
18
18
|
import "../global-style.css";
|
|
19
19
|
import VLayout from "./layout-v.vue";
|
|
20
20
|
import HLayout from "./layout-h.vue";
|
|
21
21
|
import SuMain from "./layout-main.vue";
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@
|
|
24
|
+
@Register({
|
|
25
25
|
name:"su-card",
|
|
26
26
|
components:{
|
|
27
27
|
VLayout,
|
|
@@ -30,7 +30,7 @@ import SuMain from "./layout-main.vue";
|
|
|
30
30
|
}
|
|
31
31
|
})
|
|
32
32
|
export default class SuCard extends Vue {
|
|
33
|
-
$refs
|
|
33
|
+
declare $refs: {
|
|
34
34
|
body:HTMLDivElement
|
|
35
35
|
bodyInner:HTMLDivElement
|
|
36
36
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SuPage } from "./page.vue";
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="star-ui su-page">
|
|
3
|
+
<header class="su-ui su-page--header">
|
|
4
|
+
<span v-if="suControl.isMobile" class="star-ui-icon-font star-ui-icon-menu su-page--mobile-menu-open" @click="isOpenMenu=true" />
|
|
5
|
+
<h1 v-if="title">{{title}}</h1>
|
|
6
|
+
<img v-if="logo" :src="logo" alt="logo" />
|
|
7
|
+
<slot name="header"></slot>
|
|
8
|
+
<div v-if="!suControl.isMobile" class="su-page--menu-box">
|
|
9
|
+
<su-menu :menu="menu" direction="h"></su-menu>
|
|
10
|
+
</div>
|
|
11
|
+
</header>
|
|
12
|
+
<main class="su-ui su-page--main">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</main>
|
|
15
|
+
<div v-if="suControl.isMobile" :class="['su-ui', 'su-page--mobile-menu-box', isOpenMenu ? 'su-page--mobile-menu-box-open' : 'su-page--mobile-menu-close']" @click="isOpenMenu=false">
|
|
16
|
+
<su-menu :menu="menu" direction="v" @click.stop></su-menu>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { Vue } from "vue-class-component";
|
|
23
|
+
import { Inject } from "vue-property-decorator";
|
|
24
|
+
import { Prop, Register } from "@ui-root/reg";
|
|
25
|
+
import { SuViewControl } from "@ui-root/main";
|
|
26
|
+
import { SuMenu } from "@ui-root/components/menu";
|
|
27
|
+
import { MenuItem } from "@ui-root/types";
|
|
28
|
+
import { ViewCtrlInfo } from "@ui-root/types";
|
|
29
|
+
import "@ui-root/global-style.css";
|
|
30
|
+
|
|
31
|
+
@Register({
|
|
32
|
+
name:"su-page",
|
|
33
|
+
components: {
|
|
34
|
+
SuMenu,
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
export default class SuMain extends Vue {
|
|
38
|
+
@Inject({from:SuViewControl.injectSymbol,default:{}}) readonly suControl!: ViewCtrlInfo;
|
|
39
|
+
@Prop({
|
|
40
|
+
type: String,
|
|
41
|
+
default: '',
|
|
42
|
+
})
|
|
43
|
+
private title!:string;
|
|
44
|
+
@Prop({
|
|
45
|
+
type: String,
|
|
46
|
+
default: '',
|
|
47
|
+
})
|
|
48
|
+
private logo!:string;
|
|
49
|
+
@Prop({
|
|
50
|
+
type: Array,
|
|
51
|
+
default: '',
|
|
52
|
+
})
|
|
53
|
+
private menu!:MenuItem[];
|
|
54
|
+
private isOpenMenu = false;
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
.su-page{
|
|
60
|
+
margin: 0;
|
|
61
|
+
padding: 0;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
}
|
|
67
|
+
.su-page--header{
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: row;
|
|
70
|
+
background: #000;
|
|
71
|
+
color: #e6eaf0;
|
|
72
|
+
align-items: center;
|
|
73
|
+
}
|
|
74
|
+
.su-page--header>h1{
|
|
75
|
+
font-size: 20px;
|
|
76
|
+
line-height: 22px;
|
|
77
|
+
padding: 0 20px;
|
|
78
|
+
}
|
|
79
|
+
.su-page--menu-box{
|
|
80
|
+
flex: 1;
|
|
81
|
+
height: 100%;
|
|
82
|
+
}
|
|
83
|
+
.su-page--menu-box .star-ui-menu-h--chlild-box{
|
|
84
|
+
color: var(--star-ui-font-color);
|
|
85
|
+
}
|
|
86
|
+
.su-page--menu-box .su-menu{
|
|
87
|
+
height: 100%;
|
|
88
|
+
}
|
|
89
|
+
.su-page--mobile-menu-open{
|
|
90
|
+
margin-left: 15px;
|
|
91
|
+
font-size: 20px;
|
|
92
|
+
}
|
|
93
|
+
.su-page--mobile-menu-box{
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 0;
|
|
96
|
+
left: 0;
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 100%;
|
|
99
|
+
transition: opacity 0.5s;
|
|
100
|
+
background-color: rgba(128, 128, 128, 0.5);
|
|
101
|
+
}
|
|
102
|
+
.su-page--mobile-menu-close{
|
|
103
|
+
pointer-events: none;
|
|
104
|
+
opacity: 0;
|
|
105
|
+
}
|
|
106
|
+
.su-page--mobile-menu-box .star-ui-menu-v{
|
|
107
|
+
margin-left: 0;
|
|
108
|
+
transition: margin-left 0.5s;
|
|
109
|
+
background-color: var(--star-ui-backgorund-color);
|
|
110
|
+
width: 80%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
border-right: solid 1px var(--star-ui-line-color);
|
|
113
|
+
}
|
|
114
|
+
.su-page--mobile-menu-close .star-ui-menu-v{
|
|
115
|
+
margin-left: -100%;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
package/src/components/input.vue
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import {
|
|
9
|
-
import { Prop, Emit } from "
|
|
8
|
+
import { Vue } from 'vue-class-component';
|
|
9
|
+
import { Register, Prop, Emit } from "@ui-root/reg";
|
|
10
10
|
import "../global-style.css";
|
|
11
11
|
|
|
12
|
-
@
|
|
12
|
+
@Register({
|
|
13
13
|
name:"su-input"
|
|
14
14
|
})
|
|
15
15
|
export default class SuInput extends Vue {
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { Vue } from "vue-class-component";
|
|
9
|
+
import { Register } from "@ui-root/reg";
|
|
9
10
|
import "../global-style.css";
|
|
10
11
|
|
|
11
|
-
@
|
|
12
|
+
@Register({
|
|
12
13
|
name:"su-h-layout",
|
|
13
|
-
props: {
|
|
14
|
-
}
|
|
15
14
|
})
|
|
16
15
|
export default class SuHLayout extends Vue {
|
|
17
16
|
}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { Vue } from "vue-class-component";
|
|
9
|
+
import { Register } from "@ui-root/reg";
|
|
9
10
|
import "../global-style.css";
|
|
10
11
|
|
|
11
|
-
@
|
|
12
|
+
@Register({
|
|
12
13
|
name:"su-main",
|
|
13
14
|
props: {
|
|
14
15
|
}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { Vue } from "vue-class-component";
|
|
9
|
+
import { Register } from "@ui-root/reg";
|
|
9
10
|
import "../global-style.css";
|
|
10
11
|
|
|
11
|
-
@
|
|
12
|
+
@Register({
|
|
12
13
|
name:"su-v-layout",
|
|
13
14
|
props: {
|
|
14
15
|
}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
|
-
import {
|
|
6
|
+
import { Vue } from "vue-class-component";
|
|
7
|
+
import { Register } from "@ui-root/reg";
|
|
7
8
|
import "../global-style.css";
|
|
8
9
|
|
|
9
|
-
@
|
|
10
|
+
@Register({
|
|
10
11
|
name:"su-h-line",
|
|
11
12
|
props: {
|
|
12
13
|
}
|
|
@@ -18,11 +19,11 @@ export default class SuHLine extends Vue {
|
|
|
18
19
|
<style>
|
|
19
20
|
.su-h-line{
|
|
20
21
|
background-color:var(--star-ui-line-color);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
width:100%;
|
|
23
|
+
height:var(--star-ui-line-width);
|
|
24
|
+
min-height:var(--star-ui-line-width);
|
|
25
|
+
max-height:var(--star-ui-line-width);
|
|
26
|
+
flex:0 0 var(--star-ui-line-width);
|
|
27
|
+
padding: 0;
|
|
27
28
|
}
|
|
28
29
|
</style>
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
|
-
import {
|
|
6
|
+
import { Vue } from "vue-class-component";
|
|
7
|
+
import { Register } from "@ui-root/reg";
|
|
7
8
|
import "../global-style.css";
|
|
8
9
|
|
|
9
|
-
@
|
|
10
|
+
@Register({
|
|
10
11
|
name:"su-v-line",
|
|
11
12
|
props: {
|
|
12
13
|
}
|
|
@@ -18,11 +19,11 @@ export default class SuVLine extends Vue {
|
|
|
18
19
|
<style>
|
|
19
20
|
.su-v-line{
|
|
20
21
|
background-color:var(--star-ui-line-color);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
/*height:100%;*/
|
|
23
|
+
width:var(--star-ui-line-width);
|
|
24
|
+
min-width:var(--star-ui-line-width);
|
|
25
|
+
max-width:var(--star-ui-line-width);
|
|
26
|
+
flex:0 0 var(--star-ui-line-width);
|
|
27
|
+
padding: 0;
|
|
27
28
|
}
|
|
28
29
|
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as SuMenu} from "./index.vue";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="menuComponent" :menu="menu" class="su-menu">
|
|
3
|
+
<template v-slot="data">
|
|
4
|
+
<div @click="handleItemClick(data)">
|
|
5
|
+
<slot v-if="$slots['default']" v-bind="data" />
|
|
6
|
+
<component v-else :is="displayComponent" :[useedKey]="data.path" @click.prevent>
|
|
7
|
+
{{data.title}}
|
|
8
|
+
</component>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
16
|
+
import { ConcreteComponent } from "vue";
|
|
17
|
+
import { Vue } from "vue-class-component";
|
|
18
|
+
import HMenu from "./menu-h/index.vue";
|
|
19
|
+
import VMenu from "./menu-v/index.vue";
|
|
20
|
+
import { MenuItem } from "@ui-root/types";
|
|
21
|
+
import '@ui-root/global-style.css';
|
|
22
|
+
|
|
23
|
+
@Register({
|
|
24
|
+
name: 'su-menu',
|
|
25
|
+
})
|
|
26
|
+
export default class SuHMenu extends Vue {
|
|
27
|
+
@Prop({
|
|
28
|
+
type: Array,
|
|
29
|
+
required: true,
|
|
30
|
+
})
|
|
31
|
+
private menu!:MenuItem[];
|
|
32
|
+
@Prop({
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
default: 'h'
|
|
36
|
+
})
|
|
37
|
+
private direction!:"h"|"v"|"row";
|
|
38
|
+
private get menuComponent(){
|
|
39
|
+
if (["h",'row','r'].includes(this.direction)){
|
|
40
|
+
return HMenu;
|
|
41
|
+
}
|
|
42
|
+
return VMenu;
|
|
43
|
+
}
|
|
44
|
+
@Prop({
|
|
45
|
+
type: [String,Function,Object],
|
|
46
|
+
default: undefined,
|
|
47
|
+
})
|
|
48
|
+
private component!:string|Vue|Record<string, unknown>|ConcreteComponent|undefined;
|
|
49
|
+
private get displayComponent():string|Vue|ConcreteComponent|Record<string, unknown>{
|
|
50
|
+
if(this.component) return this.component;
|
|
51
|
+
// const vueRouterLink = resolveComponent('router-link');
|
|
52
|
+
// if(typeof vueRouterLink != 'string') return vueRouterLink;
|
|
53
|
+
return 'a';
|
|
54
|
+
}
|
|
55
|
+
@Prop({
|
|
56
|
+
type: String,
|
|
57
|
+
default: ()=>"",
|
|
58
|
+
})
|
|
59
|
+
private key!:string;
|
|
60
|
+
private get useedKey():string{
|
|
61
|
+
if(this.component && this.key) return this.key;
|
|
62
|
+
if(this.displayComponent == "a") return 'href';
|
|
63
|
+
return 'to';
|
|
64
|
+
}
|
|
65
|
+
private handleItemClick(data:MenuItem){debugger
|
|
66
|
+
if (!["h",'row','r'].includes(this.direction) && data.children){
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if ((this as any).$router) {
|
|
70
|
+
(this as any).$router.push(data.path);
|
|
71
|
+
} else {
|
|
72
|
+
history.pushState(null, '', data.path);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
</script>
|
|
78
|
+
<style>
|
|
79
|
+
.su-menu a{
|
|
80
|
+
color: inherit;
|
|
81
|
+
text-decoration: none;
|
|
82
|
+
}
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['star-ui', 'star-ui-menu', 'star-ui-menu-h']">
|
|
3
|
+
<su-h-menu-item v-for="item in menu" :key="item.path" :item="item" childDirection="bottom">
|
|
4
|
+
<template v-slot="data">
|
|
5
|
+
<slot v-bind="data" />
|
|
6
|
+
</template>
|
|
7
|
+
</su-h-menu-item>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
13
|
+
import { Vue } from 'vue-class-component';
|
|
14
|
+
import SuHMenuChild from "./menu-h-child.vue";
|
|
15
|
+
import SuHMenuItem from "./menu-h-item.vue";
|
|
16
|
+
import { MenuItem } from "@ui-root/types";
|
|
17
|
+
import '@ui-root/global-style.css';
|
|
18
|
+
|
|
19
|
+
@Register({
|
|
20
|
+
name: 'su-h-menu',
|
|
21
|
+
watch:{
|
|
22
|
+
menu(this:SuHMenu){
|
|
23
|
+
this.splitMenu();
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
components:{
|
|
27
|
+
SuHMenuChild,
|
|
28
|
+
SuHMenuItem,
|
|
29
|
+
},
|
|
30
|
+
internalOnly:true,
|
|
31
|
+
})
|
|
32
|
+
export default class SuHMenu extends Vue {
|
|
33
|
+
@Prop({
|
|
34
|
+
type: Array,
|
|
35
|
+
required: true,
|
|
36
|
+
})
|
|
37
|
+
private menu!:MenuItem[];
|
|
38
|
+
private splitMenu(){
|
|
39
|
+
this.displayItem=[...this.menu];
|
|
40
|
+
}
|
|
41
|
+
private displayItem:MenuItem[]=[];
|
|
42
|
+
created():void{
|
|
43
|
+
this.splitMenu();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
</script>
|
|
48
|
+
<style>
|
|
49
|
+
.star-ui-menu-h{
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
overflow: visible;
|
|
53
|
+
position: relative;
|
|
54
|
+
padding: 0;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
}
|
|
57
|
+
.star-ui-menu-h>.star-ui-menu-h--item-box>.star-ui-menu-h--item a{
|
|
58
|
+
line-height: 2;
|
|
59
|
+
border: solid 2px transparent;
|
|
60
|
+
transition: border 0.5s;
|
|
61
|
+
padding: 2px;
|
|
62
|
+
}
|
|
63
|
+
.star-ui-menu-h>.star-ui-menu-h--item-box:hover>.star-ui-menu-h--item a{
|
|
64
|
+
border-bottom-color: var(--star-ui-base-color);
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="menu && menu.length>0" :class="['star-ui', 'star-ui-menu--chlild-box', 'star-ui-menu-h--chlild-box', `star-ui-menu-h--chlild-box-${direction}`]">
|
|
3
|
+
<component :is="itemComponent" v-for="item in menu" :key="item.path" :item="item">
|
|
4
|
+
<template v-slot="item">
|
|
5
|
+
<slot v-bind="item" />
|
|
6
|
+
</template>
|
|
7
|
+
</component>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
13
|
+
import { Vue } from 'vue-class-component';
|
|
14
|
+
import { MenuItem } from "@ui-root/types";
|
|
15
|
+
import '@ui-root/global-style.css';
|
|
16
|
+
|
|
17
|
+
@Register({
|
|
18
|
+
name: 'su-h-menu-child',
|
|
19
|
+
internalOnly: true,
|
|
20
|
+
components:{
|
|
21
|
+
// SuHMenuItem,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
export default class SuHMenuChild extends Vue {
|
|
25
|
+
@Prop({
|
|
26
|
+
type: Array,
|
|
27
|
+
required: true,
|
|
28
|
+
})
|
|
29
|
+
private menu!:MenuItem[];
|
|
30
|
+
@Prop({})
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
private itemComponent!:any;
|
|
33
|
+
@Prop({
|
|
34
|
+
type: String,
|
|
35
|
+
})
|
|
36
|
+
private direction!:'right'|'bottom';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
</script>
|
|
40
|
+
<style>
|
|
41
|
+
.star-ui-menu-h--chlild-box{
|
|
42
|
+
position: absolute;
|
|
43
|
+
background-color: var(--star-ui-backgorund-color);
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transition: opacity 0.5s;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
}
|
|
48
|
+
*:hover>.star-ui-menu-h--chlild-box{
|
|
49
|
+
display: block;
|
|
50
|
+
opacity: 1;
|
|
51
|
+
pointer-events: auto;
|
|
52
|
+
}
|
|
53
|
+
.star-ui-menu-h--chlild-box-right{
|
|
54
|
+
left: 100%;
|
|
55
|
+
top:0;
|
|
56
|
+
}
|
|
57
|
+
.star-ui-menu-h--chlild-box-left{
|
|
58
|
+
right: 100%;
|
|
59
|
+
top:0;
|
|
60
|
+
}
|
|
61
|
+
.star-ui-menu-h--chlild-box-bottom{
|
|
62
|
+
left: 0;
|
|
63
|
+
top:100%;
|
|
64
|
+
}
|
|
65
|
+
.star-ui-menu-h--chlild-box{
|
|
66
|
+
border: solid 1px var(--star-ui-line-color);
|
|
67
|
+
}
|
|
68
|
+
.star-ui-menu-h--chlild-box>.star-ui-menu-h--item-box>.star-ui-menu-h--item{
|
|
69
|
+
border-bottom: solid 1px var(--star-ui-line-color);
|
|
70
|
+
}
|
|
71
|
+
.star-ui-menu-h--chlild-box>.star-ui-menu-h--item-box:last-child>.star-ui-menu-h--item{
|
|
72
|
+
border-bottom-width: 0;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="star-ui star-ui-menu--item-box star-ui-menu-h--item-box">
|
|
3
|
+
<div class="star-ui star-ui-menu--item star-ui-menu-h--item">
|
|
4
|
+
<slot v-bind="item" />
|
|
5
|
+
</div>
|
|
6
|
+
<su-h-menu-child :menu="item.children || []" :itemComponent="selfClass" :direction="childDirection">
|
|
7
|
+
<template v-slot="item">
|
|
8
|
+
<slot v-bind="item" />
|
|
9
|
+
</template>
|
|
10
|
+
</su-h-menu-child>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
16
|
+
import { Vue } from "vue-class-component";
|
|
17
|
+
import SuHMenuChild from "./menu-h-child.vue";
|
|
18
|
+
import isFocus from "@ui-root/directives/is-focus";
|
|
19
|
+
import { MenuItem } from "@ui-root/types";
|
|
20
|
+
import '@ui-root/global-style.css';
|
|
21
|
+
|
|
22
|
+
@Register({
|
|
23
|
+
name: 'su-h-menu-item',
|
|
24
|
+
internalOnly: true,
|
|
25
|
+
components:{
|
|
26
|
+
SuHMenuChild,
|
|
27
|
+
},
|
|
28
|
+
directives:{
|
|
29
|
+
isFocus,
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
export default class SuHMenuItem extends Vue {
|
|
33
|
+
isFocus=false;
|
|
34
|
+
@Prop({
|
|
35
|
+
type: Object,
|
|
36
|
+
})
|
|
37
|
+
private item!:MenuItem;
|
|
38
|
+
private selfClass = SuHMenuItem;
|
|
39
|
+
@Prop({
|
|
40
|
+
type: String,
|
|
41
|
+
default:'right',
|
|
42
|
+
})
|
|
43
|
+
private childDirection!:'right'|'bottom';
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
<style>
|
|
47
|
+
.star-ui-menu-h--item-box{
|
|
48
|
+
height: 100%;
|
|
49
|
+
overflow: visible;
|
|
50
|
+
position: relative;
|
|
51
|
+
padding: 0;
|
|
52
|
+
transition: background-color 0.5s;
|
|
53
|
+
}
|
|
54
|
+
.star-ui-menu-h--item-box:hover{
|
|
55
|
+
background-color: rgba(128,128,128,0.4);
|
|
56
|
+
}
|
|
57
|
+
.star-ui-menu-h--item{
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
height: 100%;
|
|
63
|
+
padding: 8px;
|
|
64
|
+
}
|
|
65
|
+
</style>
|