@thestarweb/ui 1.5.2 → 1.7.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/dist/star-ui.common.js +9086 -1335
- package/dist/star-ui.common.js.map +1 -1
- package/dist/star-ui.umd.js +9088 -1337
- package/dist/star-ui.umd.js.map +1 -1
- package/dist/star-ui.umd.min.js +139 -139
- package/dist/star-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button.vue +4 -4
- package/src/components/calendar.vue +8 -8
- package/src/components/card.vue +1 -1
- package/src/components/common/base-popper.vue +28 -27
- package/src/components/content/context-menu-box/index.vue +117 -0
- package/src/components/content/index.ts +5 -1
- package/src/components/{menu → content/menu}/index.vue +2 -2
- package/src/components/{menu → content/menu}/menu-h/index.vue +3 -1
- package/src/components/{menu → content/menu}/menu-h/menu-h-child.vue +0 -0
- package/src/components/{menu → content/menu}/menu-h/menu-h-item.vue +4 -3
- package/src/components/{menu → content/menu}/menu-v/index.vue +0 -0
- package/src/components/content/modals/confirm.vue +45 -0
- package/src/components/content/modals/modal.vue +110 -0
- package/src/components/content/page.vue +2 -1
- package/src/components/form/form/form-item.vue +116 -0
- package/src/components/form/form/form.vue +109 -0
- package/src/components/form/form/index.ts +2 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/input.vue +2 -1
- package/src/components/layout/auto-direction/index.vue +28 -0
- package/src/components/layout/index.ts +1 -0
- package/src/components/layout-h.vue +4 -4
- package/src/components/layout-main.vue +2 -2
- package/src/components/layout-v.vue +4 -4
- package/src/components/line-h.vue +2 -2
- package/src/components/line-v.vue +2 -2
- package/src/components/select.vue +6 -6
- package/src/components/switch.vue +1 -1
- package/src/components/table.vue +11 -11
- package/src/components/tree/index.vue +1 -0
- package/src/components/view-control.vue +12 -19
- package/src/func/download.ts +15 -0
- package/src/func/index.ts +2 -0
- package/src/func/modal/index.ts +72 -0
- package/src/global-style.css +75 -1
- package/src/main.ts +5 -1
- package/src/outher/index.ts +5 -1
- package/src/reg.ts +38 -3
- package/src/types.d.ts +6 -0
- package/types/components/common/base-popper.vue.d.ts +5 -2
- package/types/components/content/context-menu-box/index.vue.d.ts +20 -0
- package/types/components/content/index.d.ts +4 -0
- package/types/components/{menu → content/menu}/index.vue.d.ts +0 -0
- package/types/components/{menu → content/menu}/menu-h/index.vue.d.ts +0 -0
- package/types/components/{menu → content/menu}/menu-h/menu-h-child.vue.d.ts +0 -0
- package/types/components/{menu → content/menu}/menu-h/menu-h-item.vue.d.ts +0 -0
- package/types/components/{menu → content/menu}/menu-v/index.vue.d.ts +0 -0
- package/types/components/content/modals/confirm.vue.d.ts +7 -0
- package/types/components/content/modals/modal.vue.d.ts +12 -0
- package/types/components/form/form/form-item.vue.d.ts +22 -0
- package/types/components/form/form/form.vue.d.ts +24 -0
- package/types/components/form/form/index.d.ts +2 -0
- package/types/components/form/index.d.ts +1 -0
- package/types/components/layout/auto-direction/index.vue.d.ts +4 -0
- package/types/components/layout/index.d.ts +1 -0
- package/types/components/view-control.vue.d.ts +1 -0
- package/types/func/download.d.ts +1 -0
- package/types/func/index.d.ts +2 -0
- package/types/func/modal/index.d.ts +13 -0
- package/types/main.d.ts +3 -1
- package/types/outher/index.d.ts +3 -0
- package/types/reg.d.ts +10 -1
- package/src/components/menu/index.ts +0 -1
- package/types/components/menu/index.d.ts +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form :class="`star-ui su-form star-ui-form ${allowAotoMobile?'star-ui-form--auto-mobile':''}`">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</form>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { Vue } from "vue-class-component";
|
|
9
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
10
|
+
import type { TypeFormLabelAlign } from "@ui-root/outher";
|
|
11
|
+
import { Provide } from "vue-property-decorator";
|
|
12
|
+
import Item, { InjectEventBus, InjectLabelAlign, InjectLabelWidth } from "./form-item.vue";
|
|
13
|
+
|
|
14
|
+
import "@ui-root/global-style.css";
|
|
15
|
+
|
|
16
|
+
export interface Bus{
|
|
17
|
+
addItem:(item:Item)=>void,
|
|
18
|
+
removeItem:(item:Item)=>void,
|
|
19
|
+
labelUpdate:(item:Item)=>void,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Register({
|
|
23
|
+
name:"su-form",
|
|
24
|
+
})
|
|
25
|
+
export default class SuButton extends Vue {
|
|
26
|
+
@Prop({
|
|
27
|
+
autoType: "FormLabelAlign",
|
|
28
|
+
default:()=>{
|
|
29
|
+
return "right"
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
@Provide({to:InjectLabelAlign,reactive:true})
|
|
33
|
+
readonly labelAlign!:TypeFormLabelAlign;
|
|
34
|
+
@Prop({
|
|
35
|
+
type: Number
|
|
36
|
+
})
|
|
37
|
+
readonly labelWidth!:number|undefined;
|
|
38
|
+
@Prop({
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default:()=>{
|
|
41
|
+
return true
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
readonly allowAotoMobile!:boolean;
|
|
45
|
+
@Provide({to:InjectEventBus,reactive:true})
|
|
46
|
+
private bus:Bus|undefined;
|
|
47
|
+
private items=new Set<Item>();
|
|
48
|
+
private addItem(item:Item):void{
|
|
49
|
+
this.items.add(item);
|
|
50
|
+
this.$nextTick(this.updateLabelWidth);
|
|
51
|
+
}
|
|
52
|
+
private removeItem(item:Item):void{
|
|
53
|
+
this.items.delete(item);
|
|
54
|
+
this.$nextTick(this.updateLabelWidth);
|
|
55
|
+
}
|
|
56
|
+
private updateLabelWidth(){
|
|
57
|
+
if(!this.isLoaded) return;
|
|
58
|
+
if(typeof this.labelWidth === 'undefined'){
|
|
59
|
+
this.sendLabelWidth = undefined;
|
|
60
|
+
}else if(this.labelWidth === 0){
|
|
61
|
+
this.sendLabelWidth=undefined;
|
|
62
|
+
this.$nextTick(() => {
|
|
63
|
+
let maxWidth = 0;
|
|
64
|
+
this.items.forEach((item => {
|
|
65
|
+
if((item.labelAlign||this.labelAlign) === 'top'){
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const width = item.$refs.labelDiv.offsetWidth;
|
|
69
|
+
if(width>maxWidth){
|
|
70
|
+
maxWidth=width;
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
this.sendLabelWidth=maxWidth;
|
|
74
|
+
})
|
|
75
|
+
}else{
|
|
76
|
+
this.sendLabelWidth=this.labelWidth;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
private isLoaded=false;
|
|
80
|
+
@Provide({to:InjectLabelWidth,reactive:true})
|
|
81
|
+
private sendLabelWidth:number|undefined=0;
|
|
82
|
+
created(){
|
|
83
|
+
this.bus={
|
|
84
|
+
addItem: this.addItem,
|
|
85
|
+
removeItem: this.removeItem,
|
|
86
|
+
labelUpdate: this.updateLabelWidth,
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
mounted(){
|
|
90
|
+
this.$nextTick(() => {
|
|
91
|
+
this.isLoaded=true;
|
|
92
|
+
this.updateLabelWidth();
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
beforeUnmount(){
|
|
96
|
+
this.isLoaded=false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
<style>
|
|
101
|
+
.star-ui-form{
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: row;
|
|
104
|
+
flex-wrap: wrap;
|
|
105
|
+
}
|
|
106
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-form--auto-mobile>.star-ui-form-item{
|
|
107
|
+
width: 100%;
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./form/index";
|
package/src/components/input.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="['star-ui','star-ui-input',{'is-focus':isFocused}]">
|
|
2
|
+
<div :class="['star-ui', 'su-input','star-ui-input',{'is-focus':isFocused}]">
|
|
3
3
|
<input type="text" ref="input" :value="modelValue" :name="name" :class="['star-ui','star-ui-input--inner','star-ui-size-'+size]" @input.stop="handleInput" @focus="handleFocus" @blur="handleBlur">
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -76,5 +76,6 @@ export default class SuInput extends Vue {
|
|
|
76
76
|
flex:1;
|
|
77
77
|
color: unset;
|
|
78
78
|
background: unset;
|
|
79
|
+
width: 100%;
|
|
79
80
|
}
|
|
80
81
|
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="star-ui star-ui-auto-direction su-auto-direction">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { Vue } from "vue-class-component";
|
|
9
|
+
import { Register } from "@ui-root/reg";
|
|
10
|
+
import "@ui-root/global-style.css";
|
|
11
|
+
|
|
12
|
+
@Register({
|
|
13
|
+
name:"su-auto-direction",
|
|
14
|
+
})
|
|
15
|
+
export default class SuAutoDirection extends Vue {
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
.star-ui-auto-direction{
|
|
21
|
+
display: flex;
|
|
22
|
+
padding: 0;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
}
|
|
25
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-auto-direction{
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SuAutoDirection } from "./auto-direction/index.vue";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui su-h-layout">
|
|
2
|
+
<div class="star-ui su-h-layout star-ui-h-layout">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -17,7 +17,7 @@ export default class SuHLayout extends Vue {
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<style>
|
|
20
|
-
.
|
|
20
|
+
.star-ui-h-layout{
|
|
21
21
|
display: flex;
|
|
22
22
|
flex-direction: row;
|
|
23
23
|
width: 100%;
|
|
@@ -25,10 +25,10 @@ export default class SuHLayout extends Vue {
|
|
|
25
25
|
padding: 0;
|
|
26
26
|
overflow: hidden;
|
|
27
27
|
}
|
|
28
|
-
.
|
|
28
|
+
.star-ui-h-layout>*{
|
|
29
29
|
flex:0 0 auto;
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
.star-ui-h-layout>.star-ui-main{
|
|
32
32
|
width: 0;
|
|
33
33
|
}
|
|
34
34
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui su-main">
|
|
2
|
+
<div class="star-ui su-main star-ui-main">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -19,7 +19,7 @@ export default class SuMain extends Vue {
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<style>
|
|
22
|
-
.
|
|
22
|
+
.star-ui-main{
|
|
23
23
|
flex: 1;
|
|
24
24
|
}
|
|
25
25
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui su-v-layout">
|
|
2
|
+
<div class="star-ui su-v-layout star-ui-v-layout">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -19,7 +19,7 @@ export default class SuVLayout extends Vue {
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<style>
|
|
22
|
-
.
|
|
22
|
+
.star-ui-v-layout{
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
width: 100%;
|
|
@@ -27,10 +27,10 @@ export default class SuVLayout extends Vue {
|
|
|
27
27
|
padding: 0;
|
|
28
28
|
overflow: hidden;
|
|
29
29
|
}
|
|
30
|
-
.
|
|
30
|
+
.star-ui-v-layout>*{
|
|
31
31
|
flex:0 0 auto;
|
|
32
32
|
}
|
|
33
|
-
.
|
|
33
|
+
.star-ui-v-layout>.star-ui-main{
|
|
34
34
|
height: 0;
|
|
35
35
|
}
|
|
36
36
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
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">
|
|
@@ -17,7 +17,7 @@ export default class SuHLine extends Vue {
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<style>
|
|
20
|
-
.
|
|
20
|
+
.star-ui-h-line{
|
|
21
21
|
background-color:var(--star-ui-line-color);
|
|
22
22
|
width:100%;
|
|
23
23
|
height:var(--star-ui-line-width);
|
|
@@ -1,5 +1,5 @@
|
|
|
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">
|
|
@@ -17,7 +17,7 @@ export default class SuVLine extends Vue {
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<style>
|
|
20
|
-
.
|
|
20
|
+
.star-ui-v-line{
|
|
21
21
|
background-color:var(--star-ui-line-color);
|
|
22
22
|
/*height:100%;*/
|
|
23
23
|
width:var(--star-ui-line-width);
|
|
@@ -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">
|
|
@@ -240,26 +240,26 @@ export default class SuSelect extends Vue {
|
|
|
240
240
|
font-weight: bold;
|
|
241
241
|
padding: var(--star-ui-default-padding);
|
|
242
242
|
}
|
|
243
|
-
.
|
|
243
|
+
.star-ui-view-control-mobile .star-ui-select--pooper{
|
|
244
244
|
width: 100%;
|
|
245
245
|
}
|
|
246
|
-
.
|
|
246
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-select--pooper{
|
|
247
247
|
border-radius: 0;
|
|
248
248
|
border-width: 0;
|
|
249
249
|
}
|
|
250
|
-
.
|
|
250
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-select--option{
|
|
251
251
|
border-radius: 0;
|
|
252
252
|
padding-left: 10px;
|
|
253
253
|
border-left: 5px solid transparent;
|
|
254
254
|
border-top: 1px solid var(--star-ui-input-border-color);
|
|
255
255
|
line-height: 1.5;
|
|
256
256
|
}
|
|
257
|
-
.
|
|
257
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-select--option-sel{
|
|
258
258
|
background: initial;
|
|
259
259
|
color: var(--star-ui-base-color);
|
|
260
260
|
border-left: 5px solid var(--star-ui-base-color);
|
|
261
261
|
}
|
|
262
|
-
.
|
|
262
|
+
.star-ui-view-control-mobile .star-ui-select--pooper-item-list.star-ui-size-medium{
|
|
263
263
|
max-height: 50vh;
|
|
264
264
|
}
|
|
265
265
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
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
4
|
<input ref="input" type="checkbox" :name="name" :checked="modelValue" @change="handeleChange"/>
|
|
5
5
|
<div><span></span></div>
|
package/src/components/table.vue
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui su-table">
|
|
3
|
-
<table class="star-ui
|
|
4
|
-
<thead class="star-ui
|
|
5
|
-
<tr class="star-ui
|
|
6
|
-
<th v-for="item in columns" :key="item.name+item.key" class="star-ui star-ui-container
|
|
2
|
+
<div class="star-ui su-table star-ui-table">
|
|
3
|
+
<table class="star-ui star-ui-table--inner" rules="none" frame="void">
|
|
4
|
+
<thead class="star-ui star-ui-table--inner-thead">
|
|
5
|
+
<tr class="star-ui star-ui-table--inner-tr">
|
|
6
|
+
<th v-for="item in columns" :key="item.name+item.key" class="star-ui star-ui-container star-ui-table--inner-th">{{item.name}}</th>
|
|
7
7
|
</tr>
|
|
8
8
|
</thead>
|
|
9
|
-
<tbody class="star-ui
|
|
10
|
-
<tr v-for="(row,index) in data" :key="index" class="star-ui
|
|
11
|
-
<td v-for="item in columns" :key="item.name+item.key" class="star-ui star-ui-container
|
|
9
|
+
<tbody class="star-ui star-ui-table--inner-tbody">
|
|
10
|
+
<tr v-for="(row,index) in data" :key="index" class="star-ui star-ui-table--inner-tr">
|
|
11
|
+
<td v-for="item in columns" :key="item.name+item.key" class="star-ui star-ui-container star-ui-table--inner-td">{{row[item.field]}}</td>
|
|
12
12
|
</tr>
|
|
13
13
|
<slot></slot>
|
|
14
14
|
</tbody>
|
|
@@ -47,13 +47,13 @@ export default class SuTable extends Vue {
|
|
|
47
47
|
</script>
|
|
48
48
|
|
|
49
49
|
<style>
|
|
50
|
-
.
|
|
50
|
+
.star-ui-tabl{
|
|
51
51
|
width: 100%;
|
|
52
52
|
}
|
|
53
|
-
.
|
|
53
|
+
.star-ui-table--inner-thead{
|
|
54
54
|
background-color: var(--star-ui-table-head-color);
|
|
55
55
|
}
|
|
56
|
-
.
|
|
56
|
+
.star-ui-table--inner-tr{
|
|
57
57
|
border-bottom: 1px solid #e8eaec;
|
|
58
58
|
}
|
|
59
59
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="['star-ui',
|
|
2
|
+
<div :class="['star-ui', className]">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Vue } from 'vue-class-component';
|
|
9
9
|
|
|
10
10
|
import { Register, Prop } from "@ui-root/reg";
|
|
11
|
-
import { SuViewCtrlInjectKeyIsMobile } from "@ui-root/outher";
|
|
11
|
+
import { SuViewCtrlInjectKeyClassName, SuViewCtrlInjectKeyIsMobile } from "@ui-root/outher";
|
|
12
12
|
import { Provide } from "vue-property-decorator";
|
|
13
13
|
import "../global-style.css";
|
|
14
14
|
|
|
@@ -17,26 +17,11 @@ type DeviceType='auto'|'mobile'|'pc';
|
|
|
17
17
|
|
|
18
18
|
@Register({
|
|
19
19
|
name:"su-view-control",
|
|
20
|
-
watch:{
|
|
21
|
-
$isMobile(newValue){
|
|
22
|
-
//this.sendData.isMobile = newValue;
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
// provide() {
|
|
26
|
-
// return {
|
|
27
|
-
// viewCtrlInfo: this.sendData
|
|
28
|
-
// }
|
|
29
|
-
// },
|
|
30
|
-
// created(){
|
|
31
|
-
// this.sendData.isMobile = this.$isMobile;
|
|
32
|
-
// }
|
|
33
20
|
})
|
|
34
21
|
export default class SuViewControl extends Vue {
|
|
35
22
|
mounted():void{
|
|
36
23
|
this.$el._vue = this;
|
|
37
24
|
}
|
|
38
|
-
// @Provide({to:SuViewCtrlInjectKeyIsMobile})
|
|
39
|
-
// isMobile=false;
|
|
40
25
|
@Prop({
|
|
41
26
|
type: String,
|
|
42
27
|
default: "auto",
|
|
@@ -59,7 +44,7 @@ export default class SuViewControl extends Vue {
|
|
|
59
44
|
this.windowWidth = window.innerWidth;
|
|
60
45
|
this.windowHeight = window.innerHeight;
|
|
61
46
|
}
|
|
62
|
-
@Provide({to:SuViewCtrlInjectKeyIsMobile})
|
|
47
|
+
@Provide({to:SuViewCtrlInjectKeyIsMobile,reactive:true})
|
|
63
48
|
public get $isMobile():boolean{
|
|
64
49
|
switch (this.deviceType) {
|
|
65
50
|
case "mobile":
|
|
@@ -71,11 +56,19 @@ export default class SuViewControl extends Vue {
|
|
|
71
56
|
case "ua":
|
|
72
57
|
return navigator.userAgent.toLowerCase().indexOf("mobile")!=-1;
|
|
73
58
|
case "screen-width":
|
|
74
|
-
console.log(this.windowWidth);
|
|
75
59
|
return this.windowWidth < 1000;
|
|
76
60
|
}
|
|
77
61
|
return false;
|
|
78
62
|
}
|
|
63
|
+
@Provide({to:SuViewCtrlInjectKeyClassName,reactive:true})
|
|
64
|
+
public get className():string[]{
|
|
65
|
+
return [
|
|
66
|
+
'su-view-control',
|
|
67
|
+
'star-ui-view-control',
|
|
68
|
+
`star-ui-view-control-${this.$isMobile?'mobile':'pc'}`,
|
|
69
|
+
`su-view-control-${this.$isMobile?'mobile':'pc'}`
|
|
70
|
+
];
|
|
71
|
+
}
|
|
79
72
|
beforeMount(){
|
|
80
73
|
this.checkWindowSize();
|
|
81
74
|
window.addEventListener("resize", this.checkWindowSize);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function(data:Blob|Uint8Array, name:string): void{
|
|
2
|
+
let out:Blob;
|
|
3
|
+
if (data instanceof Uint8Array) {
|
|
4
|
+
out = new Blob([data]);
|
|
5
|
+
} else {
|
|
6
|
+
out = data;
|
|
7
|
+
}
|
|
8
|
+
const link = document.createElement('a');
|
|
9
|
+
link.href = URL.createObjectURL(out);
|
|
10
|
+
link.download = name;
|
|
11
|
+
document.body.appendChild(link);
|
|
12
|
+
link.click();
|
|
13
|
+
document.body.removeChild(link);
|
|
14
|
+
URL.revokeObjectURL(link.href);
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createVNode, render, VNode } from 'vue';
|
|
2
|
+
import { SuModal,SuModalConfirm,SuViewControl } from '@ui-root/main';
|
|
3
|
+
|
|
4
|
+
type PWidthClose = Promise<boolean>&{close: () => void};
|
|
5
|
+
export function confirm(title: string):PWidthClose{
|
|
6
|
+
let vnode:VNode;
|
|
7
|
+
const p:Promise<boolean>&{
|
|
8
|
+
close?: () => void;
|
|
9
|
+
} = new Promise<boolean>((resolve) => {
|
|
10
|
+
const dom = document.createElement("div");
|
|
11
|
+
vnode = createVNode(SuModalConfirm, {
|
|
12
|
+
visible: true,
|
|
13
|
+
title,
|
|
14
|
+
onClose: () => {
|
|
15
|
+
if(vnode.props) vnode.props.visible = false;
|
|
16
|
+
render(null, dom);
|
|
17
|
+
resolve(false);
|
|
18
|
+
},
|
|
19
|
+
onConfirm: () => {
|
|
20
|
+
render(null, dom);
|
|
21
|
+
resolve(true);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
render(createVNode(SuViewControl, {}, () => vnode), dom);
|
|
26
|
+
});
|
|
27
|
+
p.close = () => (vnode.component as any).proxy.close();
|
|
28
|
+
return p as PWidthClose;
|
|
29
|
+
}
|
|
30
|
+
export function modal(slots:{
|
|
31
|
+
title?: string|VNode|(() => VNode|string);
|
|
32
|
+
body?: string|VNode|(() => VNode|string);
|
|
33
|
+
footer?: string|VNode|(() => VNode|string);
|
|
34
|
+
}|VNode|string|(() => VNode|string), controlProp = {}, defalueShow = true){
|
|
35
|
+
const sendSlots:Record<string, () => VNode|string> = {};
|
|
36
|
+
if(typeof slots === 'function'){
|
|
37
|
+
sendSlots.default = slots;
|
|
38
|
+
} else if(typeof slots === 'string' || 'type' in slots) {
|
|
39
|
+
sendSlots.default = () => slots;
|
|
40
|
+
} else {
|
|
41
|
+
const map = {
|
|
42
|
+
body: 'defalut',
|
|
43
|
+
}
|
|
44
|
+
Object.keys(slots).forEach((key) => {
|
|
45
|
+
const fn = typeof slots[key as keyof typeof slots];
|
|
46
|
+
sendSlots[key in map ? map[key as keyof typeof map] : key] = typeof fn === "function" ? fn : () => fn;
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
const dom = document.createElement("div");
|
|
50
|
+
const vnode = createVNode(
|
|
51
|
+
SuModal,
|
|
52
|
+
{
|
|
53
|
+
'onUpdate:visable': (value: boolean) => {
|
|
54
|
+
if (value) {
|
|
55
|
+
//
|
|
56
|
+
} else {
|
|
57
|
+
render(null, dom);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
sendSlots,
|
|
62
|
+
);
|
|
63
|
+
render(createVNode(SuViewControl, controlProp, () => vnode), dom);
|
|
64
|
+
|
|
65
|
+
if (defalueShow) {
|
|
66
|
+
(vnode.component as any).proxy.show();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
close: () => (vnode.component as any).proxy.close()
|
|
71
|
+
};
|
|
72
|
+
}
|
package/src/global-style.css
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
/*背景颜色*/
|
|
3
3
|
--star-ui-backgorund-color:#FFF;
|
|
4
4
|
/*背景颜色*/
|
|
5
|
+
--star-ui-mask-color:rgba(0, 0, 0, 0.5);
|
|
6
|
+
/*字体颜色*/
|
|
5
7
|
--star-ui-font-color:#222;
|
|
6
8
|
/*表格头*/
|
|
7
9
|
--star-ui-table-head-color:#f8f8f9;
|
|
@@ -50,4 +52,76 @@
|
|
|
50
52
|
line-height: var(--star-ui-input-mini-font-size);
|
|
51
53
|
padding: calc(var(--star-ui-default-padding) / 2);
|
|
52
54
|
border-radius: calc(var(--star-ui-border-radius) / 2);
|
|
53
|
-
}
|
|
55
|
+
}
|
|
56
|
+
.star-ui-col-1{
|
|
57
|
+
width: calc(100% / 24 * 1);
|
|
58
|
+
}
|
|
59
|
+
.star-ui-col-2{
|
|
60
|
+
width: calc(100% / 24 * 2);
|
|
61
|
+
}
|
|
62
|
+
.star-ui-col-3{
|
|
63
|
+
width: calc(100% / 24 * 3);
|
|
64
|
+
}
|
|
65
|
+
.star-ui-col-4{
|
|
66
|
+
width: calc(100% / 24 * 4);
|
|
67
|
+
}
|
|
68
|
+
.star-ui-col-5{
|
|
69
|
+
width: calc(100% / 24 * 5);
|
|
70
|
+
}
|
|
71
|
+
.star-ui-col-6{
|
|
72
|
+
width: calc(100% / 24 * 6);
|
|
73
|
+
}
|
|
74
|
+
.star-ui-col-7{
|
|
75
|
+
width: calc(100% / 24 * 7);
|
|
76
|
+
}
|
|
77
|
+
.star-ui-col-8{
|
|
78
|
+
width: calc(100% / 24 * 8);
|
|
79
|
+
}
|
|
80
|
+
.star-ui-col-9{
|
|
81
|
+
width: calc(100% / 24 * 9);
|
|
82
|
+
}
|
|
83
|
+
.star-ui-col-10{
|
|
84
|
+
width: calc(100% / 24 * 10);
|
|
85
|
+
}
|
|
86
|
+
.star-ui-col-11{
|
|
87
|
+
width: calc(100% / 24 * 11);
|
|
88
|
+
}
|
|
89
|
+
.star-ui-col-12{
|
|
90
|
+
width: calc(100% / 24 * 12);
|
|
91
|
+
}
|
|
92
|
+
.star-ui-col-13{
|
|
93
|
+
width: calc(100% / 24 * 13);
|
|
94
|
+
}
|
|
95
|
+
.star-ui-col-14{
|
|
96
|
+
width: calc(100% / 24 * 14);
|
|
97
|
+
}
|
|
98
|
+
.star-ui-col-15{
|
|
99
|
+
width: calc(100% / 24 * 15);
|
|
100
|
+
}
|
|
101
|
+
.star-ui-col-16{
|
|
102
|
+
width: calc(100% / 24 * 16);
|
|
103
|
+
}
|
|
104
|
+
.star-ui-col-17{
|
|
105
|
+
width: calc(100% / 24 * 17);
|
|
106
|
+
}
|
|
107
|
+
.star-ui-col-18{
|
|
108
|
+
width: calc(100% / 24 * 18);
|
|
109
|
+
}
|
|
110
|
+
.star-ui-col-19{
|
|
111
|
+
width: calc(100% / 24 * 19);
|
|
112
|
+
}
|
|
113
|
+
.star-ui-col-20{
|
|
114
|
+
width: calc(100% / 24 * 20);
|
|
115
|
+
}
|
|
116
|
+
.star-ui-col-21{
|
|
117
|
+
width: calc(100% / 24 * 22);
|
|
118
|
+
}
|
|
119
|
+
.star-ui-col-22{
|
|
120
|
+
width: calc(100% / 24 * 22);
|
|
121
|
+
}
|
|
122
|
+
.star-ui-col-23{
|
|
123
|
+
width: calc(100% / 24 * 23);
|
|
124
|
+
}
|
|
125
|
+
.star-ui-col-24{
|
|
126
|
+
width: calc(100% / 24 * 24);
|
|
127
|
+
}
|
package/src/main.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as SuVLine } from "./components/line-v.vue";
|
|
|
8
8
|
export { default as SuCard } from "./components/card.vue";
|
|
9
9
|
export { default as SuTree } from "./components/tree/index.vue";
|
|
10
10
|
//表单
|
|
11
|
+
export * from "./components/form";
|
|
11
12
|
export { default as SuInput } from "./components/input.vue";
|
|
12
13
|
export { default as SuSelect } from "./components/select.vue";
|
|
13
14
|
export { default as SuButton } from "./components/button.vue";
|
|
@@ -19,9 +20,11 @@ export { default as SuCalendar } from "./components/calendar.vue";
|
|
|
19
20
|
|
|
20
21
|
export { default as SuViewControl } from "./components/view-control.vue";
|
|
21
22
|
|
|
22
|
-
export * from "./components/
|
|
23
|
+
export * from "./components/layout"
|
|
23
24
|
export * from "./components/content";
|
|
24
25
|
|
|
26
|
+
export * as func from "./func/index";
|
|
27
|
+
|
|
25
28
|
import { data } from "./reg";
|
|
26
29
|
export * from "./outher";
|
|
27
30
|
|
|
@@ -49,5 +52,6 @@ export default {
|
|
|
49
52
|
components,
|
|
50
53
|
install(app:App):void{
|
|
51
54
|
registComponents(app)
|
|
55
|
+
app.config.globalProperties
|
|
52
56
|
}
|
|
53
57
|
}
|
package/src/outher/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Inject } from "vue-property-decorator";
|
|
2
2
|
|
|
3
3
|
export const SuViewCtrlInjectKeyIsMobile=Symbol('SuViewCtrlInjectKeyIsMobile');
|
|
4
|
-
export const SuViewCtrlInjectIsMobile = Inject({from:SuViewCtrlInjectKeyIsMobile,default:false})
|
|
4
|
+
export const SuViewCtrlInjectIsMobile = Inject({from:SuViewCtrlInjectKeyIsMobile,default:false});
|
|
5
|
+
export const SuViewCtrlInjectKeyClassName=Symbol('SuViewCtrlInjectKeyClassName');
|
|
6
|
+
export const SuViewCtrlInjectClassName = Inject({from:SuViewCtrlInjectKeyClassName,default:[]});
|
|
7
|
+
|
|
8
|
+
export type TypeFormLabelAlign = 'left'|'right'|'top'|undefined;
|