@thestarweb/ui 1.4.2 → 1.6.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 +2394 -1319
- package/dist/star-ui.common.js.map +1 -1
- package/dist/star-ui.umd.js +2394 -1319
- package/dist/star-ui.umd.js.map +1 -1
- package/dist/star-ui.umd.min.js +75 -75
- 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 +4 -4
- package/src/components/calendar.vue +11 -11
- package/src/components/call-render.tsx +4 -3
- package/src/components/card.vue +5 -5
- package/src/components/common/base-popper.vue +12 -14
- package/src/components/content/index.ts +1 -0
- package/src/components/content/page.vue +133 -0
- package/src/components/form/form/form-item.vue +96 -0
- package/src/components/form/form/form.vue +51 -0
- package/src/components/form/form/index.ts +2 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/input.vue +5 -4
- package/src/components/layout-h.vue +7 -8
- package/src/components/layout-main.vue +5 -4
- package/src/components/layout-v.vue +7 -6
- package/src/components/line-h.vue +11 -10
- package/src/components/line-v.vue +11 -10
- package/src/components/menu/index.ts +1 -0
- package/src/components/menu/index.vue +86 -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 +13 -15
- package/src/components/slider.vue +3 -3
- package/src/components/switch.vue +44 -44
- package/src/components/table.vue +14 -14
- package/src/components/tree/index.vue +4 -3
- package/src/components/tree/tree-item.vue +5 -4
- package/src/components/view-control.vue +23 -25
- package/src/directives/is-focus.ts +10 -0
- package/src/global-style.css +76 -1
- 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 +38 -25
- package/src/outher/index.ts +8 -0
- package/src/reg.ts +62 -7
- 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 +9 -0
- package/types/components/form/form/form-item.vue.d.ts +15 -0
- package/types/components/form/form/form.vue.d.ts +8 -0
- package/types/components/form/form/index.d.ts +2 -0
- package/types/components/form/index.d.ts +1 -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 +26 -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 +16 -0
- package/types/directives/is-focus.d.ts +4 -0
- package/types/main.d.ts +70 -6
- package/types/outher/index.d.ts +5 -0
- package/types/reg.d.ts +24 -2
- package/dist/img/iconfont.ff1d7f50.svg +0 -62
- package/types/utils.d.ts +0 -3
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui su-h-line"></div>
|
|
2
|
+
<div class="star-ui su-h-line star-ui-h-line"></div>
|
|
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
|
}
|
|
@@ -16,13 +17,13 @@ export default class SuHLine extends Vue {
|
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
19
|
<style>
|
|
19
|
-
.
|
|
20
|
+
.star-ui-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>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui su-v-line"></div>
|
|
2
|
+
<div class="star-ui su-v-line star-ui-v-line"></div>
|
|
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
|
}
|
|
@@ -16,13 +17,13 @@ export default class SuVLine extends Vue {
|
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
19
|
<style>
|
|
19
|
-
.
|
|
20
|
+
.star-ui-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,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="menuComponent" :menu="menu" class="star-ui su-menu star-ui-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
|
+
<slot v-if="$slots['menu-text']" name="menu-text" v-bind="data" />
|
|
8
|
+
<template v-else>
|
|
9
|
+
{{data.title}}
|
|
10
|
+
</template>
|
|
11
|
+
</component>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
</component>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
19
|
+
import { ConcreteComponent } from "vue";
|
|
20
|
+
import { Vue } from "vue-class-component";
|
|
21
|
+
import HMenu from "./menu-h/index.vue";
|
|
22
|
+
import VMenu from "./menu-v/index.vue";
|
|
23
|
+
import { MenuItem } from "@ui-root/types";
|
|
24
|
+
import '@ui-root/global-style.css';
|
|
25
|
+
|
|
26
|
+
@Register({
|
|
27
|
+
name: 'su-menu',
|
|
28
|
+
})
|
|
29
|
+
export default class SuHMenu extends Vue {
|
|
30
|
+
@Prop({
|
|
31
|
+
type: Array,
|
|
32
|
+
required: true,
|
|
33
|
+
})
|
|
34
|
+
private menu!:MenuItem[];
|
|
35
|
+
@Prop({
|
|
36
|
+
type: String,
|
|
37
|
+
required: true,
|
|
38
|
+
default: 'h'
|
|
39
|
+
})
|
|
40
|
+
private direction!:"h"|"v"|"row";
|
|
41
|
+
private get menuComponent(){
|
|
42
|
+
if (["h",'row','r'].includes(this.direction)){
|
|
43
|
+
return HMenu;
|
|
44
|
+
}
|
|
45
|
+
return VMenu;
|
|
46
|
+
}
|
|
47
|
+
@Prop({
|
|
48
|
+
type: [String,Function,Object],
|
|
49
|
+
default: undefined,
|
|
50
|
+
})
|
|
51
|
+
private component!:string|Vue|Record<string, unknown>|ConcreteComponent|undefined;
|
|
52
|
+
private get displayComponent():string|Vue|ConcreteComponent|Record<string, unknown>{
|
|
53
|
+
if(this.component) return this.component;
|
|
54
|
+
// const vueRouterLink = resolveComponent('router-link');
|
|
55
|
+
// if(typeof vueRouterLink != 'string') return vueRouterLink;
|
|
56
|
+
return 'a';
|
|
57
|
+
}
|
|
58
|
+
@Prop({
|
|
59
|
+
type: String,
|
|
60
|
+
default: ()=>"",
|
|
61
|
+
})
|
|
62
|
+
private key!:string;
|
|
63
|
+
private get useedKey():string{
|
|
64
|
+
if(this.component && this.key) return this.key;
|
|
65
|
+
if(this.displayComponent == "a") return 'href';
|
|
66
|
+
return 'to';
|
|
67
|
+
}
|
|
68
|
+
private handleItemClick(data:MenuItem){debugger
|
|
69
|
+
if (!["h",'row','r'].includes(this.direction) && data.children){
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if ((this as any).$router) {
|
|
73
|
+
(this as any).$router.push(data.path);
|
|
74
|
+
} else {
|
|
75
|
+
history.pushState(null, '', data.path);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
</script>
|
|
81
|
+
<style>
|
|
82
|
+
.star-ui-menu a{
|
|
83
|
+
color: inherit;
|
|
84
|
+
text-decoration: none;
|
|
85
|
+
}
|
|
86
|
+
</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>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['star-ui', 'star-ui-menu', 'star-ui-menu-v']">
|
|
3
|
+
<div>
|
|
4
|
+
<span @click="handlePathClick(0)"><span class="star-ui-icon-font star-ui-icon-home" />></span>
|
|
5
|
+
<span v-for="(item,index) in path" :key="`${index}-${item.path||'nopath'}`" @click="handlePathClick(index+1)">
|
|
6
|
+
{{item.title}}>
|
|
7
|
+
</span>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-for="item in current" :key="item.path" @click="handleItemClick(item)">
|
|
10
|
+
<slot v-bind="item" />
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
17
|
+
import { Vue } from 'vue-class-component';
|
|
18
|
+
import { MenuItem } from "@ui-root/types";
|
|
19
|
+
import '@ui-root/global-style.css';
|
|
20
|
+
|
|
21
|
+
@Register({
|
|
22
|
+
name: 'su-h-menu',
|
|
23
|
+
internalOnly:true,
|
|
24
|
+
})
|
|
25
|
+
export default class SuHMenu extends Vue {
|
|
26
|
+
@Prop({
|
|
27
|
+
type: Array,
|
|
28
|
+
required: true,
|
|
29
|
+
})
|
|
30
|
+
private menu!:MenuItem[];
|
|
31
|
+
private path:MenuItem[]=[];
|
|
32
|
+
private get current():MenuItem[]{
|
|
33
|
+
if(this.path.length == 0){
|
|
34
|
+
return this.menu;
|
|
35
|
+
}
|
|
36
|
+
const item = this.path[this.path.length-1];
|
|
37
|
+
const res = [...(item.children || [])];
|
|
38
|
+
if(item.path){
|
|
39
|
+
res.unshift(item);
|
|
40
|
+
}
|
|
41
|
+
return res;
|
|
42
|
+
}
|
|
43
|
+
private handlePathClick(index:number){
|
|
44
|
+
this.path = this.path.slice(0,index);
|
|
45
|
+
}
|
|
46
|
+
private handleItemClick(item:MenuItem, ev:MouseEvent){
|
|
47
|
+
if(item.children && item.children.length > 0 && (this.path.length==0 || item!=this.path[this.path.length-1])){
|
|
48
|
+
this.path.push(item);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
</script>
|
|
54
|
+
<style>
|
|
55
|
+
|
|
56
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="['star-ui','star-ui-select',{'is-focus':isFocused}]" @click="isFocused=!isFocused">
|
|
2
|
+
<div :class="['star-ui', 'su-select','star-ui-select',{'is-focus':isFocused}]" @click="isFocused=!isFocused">
|
|
3
3
|
<!-- 原生组件 -->
|
|
4
4
|
<select :name="name" style="display: none"></select>
|
|
5
5
|
<input v-if="false" type="text" :value="1" class="star-ui star-ui-select--inner">
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
</div>
|
|
12
12
|
<!-- 选项弹窗 -->
|
|
13
13
|
<base-popper :from-item="$el" :visible="isFocused" @out-click="isFocused=false">
|
|
14
|
-
<div :class="['star-ui','star-ui-select--pooper',pooperClass]" :style="{width:
|
|
15
|
-
<div class="star-ui star-ui-select--pooper-title" v-if="
|
|
14
|
+
<div :class="['star-ui','star-ui-select--pooper',pooperClass]" :style="{width:isMobile?'100%':(width+'px')}">
|
|
15
|
+
<div class="star-ui star-ui-select--pooper-title" v-if="isMobile">请选择</div>
|
|
16
16
|
<div :class="['star-ui','star-ui-select--pooper-item-list','star-ui-size-'+size]">
|
|
17
17
|
|
|
18
18
|
<su-tree v-if="showAsTree" ref="tree" highlight-current :size="size" :treeData="options" :label="labelName" :value="valueName" :children="children" @node-click="haandleNodeClick"></su-tree>
|
|
@@ -26,18 +26,16 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script lang="ts">
|
|
29
|
-
import {
|
|
29
|
+
import { Vue } from 'vue-class-component';
|
|
30
30
|
import BasePopper from "./common/base-popper.vue";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { ViewCtrlInfo } from "../types";
|
|
31
|
+
import { Register, Emit, Prop } from "@ui-root/reg";
|
|
32
|
+
import { SuViewCtrlInjectIsMobile } from "@ui-root/outher";
|
|
34
33
|
import SuTree from "./tree/index.vue";
|
|
35
|
-
import ViewControl from "./view-control.vue";
|
|
36
34
|
|
|
37
35
|
|
|
38
36
|
import "../global-style.css";
|
|
39
37
|
|
|
40
|
-
@
|
|
38
|
+
@Register({
|
|
41
39
|
name:"su-select",
|
|
42
40
|
components:{
|
|
43
41
|
BasePopper,
|
|
@@ -113,7 +111,7 @@ export default class SuSelect extends Vue {
|
|
|
113
111
|
})
|
|
114
112
|
readonly pooperClass!:string;
|
|
115
113
|
isFocused=false;
|
|
116
|
-
@
|
|
114
|
+
@SuViewCtrlInjectIsMobile readonly isMobile!: boolean;
|
|
117
115
|
get valueMap():Map<string|number,string>{
|
|
118
116
|
const map=new Map();
|
|
119
117
|
if(this.showAsTree){
|
|
@@ -242,26 +240,26 @@ export default class SuSelect extends Vue {
|
|
|
242
240
|
font-weight: bold;
|
|
243
241
|
padding: var(--star-ui-default-padding);
|
|
244
242
|
}
|
|
245
|
-
.
|
|
243
|
+
.star-ui-view-control-mobile .star-ui-select--pooper{
|
|
246
244
|
width: 100%;
|
|
247
245
|
}
|
|
248
|
-
.
|
|
246
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-select--pooper{
|
|
249
247
|
border-radius: 0;
|
|
250
248
|
border-width: 0;
|
|
251
249
|
}
|
|
252
|
-
.
|
|
250
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-select--option{
|
|
253
251
|
border-radius: 0;
|
|
254
252
|
padding-left: 10px;
|
|
255
253
|
border-left: 5px solid transparent;
|
|
256
254
|
border-top: 1px solid var(--star-ui-input-border-color);
|
|
257
255
|
line-height: 1.5;
|
|
258
256
|
}
|
|
259
|
-
.
|
|
257
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-select--option-sel{
|
|
260
258
|
background: initial;
|
|
261
259
|
color: var(--star-ui-base-color);
|
|
262
260
|
border-left: 5px solid var(--star-ui-base-color);
|
|
263
261
|
}
|
|
264
|
-
.
|
|
262
|
+
.star-ui-view-control-mobile .star-ui-select--pooper-item-list.star-ui-size-medium{
|
|
265
263
|
max-height: 50vh;
|
|
266
264
|
}
|
|
267
265
|
</style>
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
10
|
-
import {
|
|
11
|
-
import { Prop, Emit } from "
|
|
10
|
+
import { Vue } from 'vue-class-component';
|
|
11
|
+
import { Register, Prop, Emit } from "@ui-root/reg";
|
|
12
12
|
import "../global-style.css";
|
|
13
13
|
|
|
14
|
-
@
|
|
14
|
+
@Register({
|
|
15
15
|
name:"su-slider"
|
|
16
16
|
})
|
|
17
17
|
export default class SuSlider extends Vue {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="['star-ui','star-ui-switch','star-ui-size-'+size]">
|
|
2
|
+
<div :class="['star-ui', 'su-switch','star-ui-switch','star-ui-size-'+size]">
|
|
3
3
|
<label>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
<input ref="input" type="checkbox" :name="name" :checked="modelValue" @change="handeleChange"/>
|
|
5
|
+
<div><span></span></div>
|
|
6
|
+
</label>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script lang="ts">
|
|
11
|
-
import {
|
|
11
|
+
import { Vue } from 'vue-class-component';
|
|
12
12
|
import { Watch } from "vue-property-decorator";
|
|
13
|
-
import { Prop, Emit } from "
|
|
13
|
+
import { Register, Prop, Emit } from "@ui-root/reg";
|
|
14
14
|
import "../global-style.css";
|
|
15
15
|
|
|
16
|
-
@
|
|
16
|
+
@Register({
|
|
17
17
|
name:"su-switch"
|
|
18
18
|
})
|
|
19
19
|
export default class SuInput extends Vue {
|
|
@@ -35,61 +35,61 @@ export default class SuInput extends Vue {
|
|
|
35
35
|
default:"medium"
|
|
36
36
|
})
|
|
37
37
|
size!:string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
@Emit("update:modelValue")
|
|
39
|
+
private handeleChange():boolean{
|
|
40
|
+
const nowChecked = this.$refs.input.checked;
|
|
41
|
+
this.$refs.input.checked = this.modelValue;
|
|
42
|
+
return nowChecked;
|
|
43
|
+
}
|
|
44
|
+
@Watch("modelValue")
|
|
45
|
+
private modelValueChange(newValue:boolean){
|
|
46
|
+
this.$refs.input.checked = newValue;
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<style>
|
|
52
52
|
.star-ui-switch{
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
--size: 20px;
|
|
54
|
+
display: inline-block;
|
|
55
55
|
}
|
|
56
56
|
.star-ui-switch.star-ui-size-medium{
|
|
57
|
-
|
|
57
|
+
--size: calc(var(--star-ui-input-medium-font-size) * 1.2);
|
|
58
58
|
}
|
|
59
59
|
.star-ui-switch.star-ui-size-mini{
|
|
60
|
-
|
|
60
|
+
--size: calc(var(--star-ui-input-mini-font-size) * 1.2);
|
|
61
61
|
}
|
|
62
62
|
.star-ui-switch input{
|
|
63
|
-
|
|
63
|
+
display: none;
|
|
64
64
|
}
|
|
65
65
|
.star-ui-switch div{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
width: calc(var(--size) * 2.5);
|
|
67
|
+
height: var(--size);
|
|
68
|
+
border: solid 1px var(--star-ui-base-color);
|
|
69
|
+
border-radius: var(--size);
|
|
70
|
+
overflow: hidden;
|
|
71
71
|
}
|
|
72
72
|
.star-ui-switch div span{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
display: inline-block;
|
|
74
|
+
width: calc(var(--size) - 2px);
|
|
75
|
+
height: calc(var(--size) - 2px);
|
|
76
|
+
border-radius: 50%;
|
|
77
|
+
border: solid 1px var(--star-ui-base-color);
|
|
78
|
+
position: relative;
|
|
79
|
+
background: var(--star-ui-backgorund-color);
|
|
80
|
+
transition: margin-left 0.1s;
|
|
81
81
|
}
|
|
82
82
|
.star-ui-switch div span::before{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
content: "";
|
|
84
|
+
width: 100px;
|
|
85
|
+
height: 100px;
|
|
86
|
+
background: var(--star-ui-base-color);
|
|
87
|
+
position: absolute;
|
|
88
|
+
right: 50%;
|
|
89
|
+
top:-20px;
|
|
90
|
+
z-index: -1;
|
|
91
91
|
}
|
|
92
92
|
.star-ui-switch input:checked+div span{
|
|
93
|
-
|
|
93
|
+
margin-left: calc(var(--size) * 1.5);
|
|
94
94
|
}
|
|
95
95
|
</style>
|