@thestarweb/ui 1.5.0 → 1.6.1
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 +1673 -1173
- package/dist/star-ui.common.js.map +1 -1
- package/dist/star-ui.umd.js +1673 -1173
- package/dist/star-ui.umd.js.map +1 -1
- package/dist/star-ui.umd.min.js +72 -72
- 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 +31 -35
- package/src/components/content/page.vue +26 -9
- package/src/components/form/form/form-item.vue +117 -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/menu/index.vue +7 -4
- package/src/components/select.vue +10 -12
- 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 +19 -21
- package/src/global-style.css +73 -1
- package/src/main.ts +3 -0
- package/src/outher/index.ts +8 -0
- package/src/reg.ts +38 -3
- package/src/types.d.ts +1 -1
- package/types/components/common/base-popper.vue.d.ts +6 -4
- package/types/components/content/page.vue.d.ts +1 -2
- 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/select.vue.d.ts +1 -2
- package/types/components/view-control.vue.d.ts +3 -2
- package/types/main.d.ts +3 -0
- package/types/outher/index.d.ts +5 -0
- package/types/reg.d.ts +10 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<button :class="['star-ui', 'star-ui-container', 'star-ui-button','star-ui-size-'+size]">
|
|
2
|
+
<button :class="['star-ui', 'su-container', 'star-ui-container', 'star-ui-button', 'star-ui-size-'+size]">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</button>
|
|
5
5
|
</template>
|
|
@@ -27,8 +27,8 @@ export default class SuButton extends Vue {
|
|
|
27
27
|
<style>
|
|
28
28
|
.star-ui-button{
|
|
29
29
|
border-width: 1px;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
background: var(--star-ui-backgorund-color);
|
|
32
|
+
color: var(--star-ui-font-color);
|
|
33
33
|
}
|
|
34
34
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui star-ui-calendar">
|
|
2
|
+
<div class="star-ui su-calendar star-ui-calendar">
|
|
3
3
|
<div class="star-ui-calendar--ctrl" :style="{opacity: showSelYear||showSelMonth?0:1}">
|
|
4
4
|
<div @click="dYear--"><<</div>
|
|
5
5
|
<div @click="dMonth--"><</div>
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
<div @click="dYear++">>></div>
|
|
13
13
|
</div>
|
|
14
14
|
<table cellspacing="0" cellpadding="0" :style="{opacity: showSelYear||showSelMonth?0:1}">
|
|
15
|
-
<tr class="
|
|
16
|
-
<th :class="`
|
|
15
|
+
<tr class="star-ui-calendar--inner-head">
|
|
16
|
+
<th :class="`star-ui-calendar--${item.week}`" v-for="(item,index) in displayHead" :key="index">{{item.display}}</th>
|
|
17
17
|
</tr>
|
|
18
18
|
<tr v-for="(row,index) in displayData" :key="index">
|
|
19
|
-
<td v-for="(day,index) in row" :key="index" :class="['
|
|
19
|
+
<td v-for="(day,index) in row" :key="index" :class="['star-ui-calendar--inner-cell',`star-ui-calendar--${day.week}`,{'star-ui-calendar--previous':day.isPrevious,'star-ui-calendar--next':day.isNext}]" @clcik="dateClick(day)">
|
|
20
20
|
|
|
21
21
|
<slot v-if="$slots['default']" v-bind="day" />
|
|
22
22
|
<vnodes v-else-if="renderCell" :func="renderCell" :args="[day]" />
|
|
@@ -189,17 +189,17 @@ export default class SuCalendar extends Vue {
|
|
|
189
189
|
.star-ui-calendar th,.star-ui-calendar td{
|
|
190
190
|
padding: 5px 0;
|
|
191
191
|
}
|
|
192
|
-
.
|
|
192
|
+
.star-ui-calendar--inner-head{
|
|
193
193
|
background-color: var(--star-ui-table-head-color);
|
|
194
194
|
}
|
|
195
|
-
.
|
|
195
|
+
.star-ui-calendar--inner-cell{
|
|
196
196
|
border: 1px solid #e8eaec;
|
|
197
197
|
width: 42px
|
|
198
198
|
}
|
|
199
|
-
.
|
|
199
|
+
.star-ui-calendar--inner-cell.star-ui-calendar--Sat,.star-ui-calendar--inner-cell.star-ui-calendar--Sun{
|
|
200
200
|
color: #f00;
|
|
201
201
|
}
|
|
202
|
-
.
|
|
202
|
+
.star-ui-calendar--inner-cell.star-ui-calendar--previous,.star-ui-calendar--inner-cell.star-ui-calendar--next{
|
|
203
203
|
opacity: 0.5;
|
|
204
204
|
}
|
|
205
205
|
|
package/src/components/card.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="star-ui star-ui-card">
|
|
2
|
+
<div class="star-ui su-card star-ui-card">
|
|
3
3
|
<div v-if="title!=''||collapsible||this.$slots.title" class="star-ui star-ui-container star-ui-card--inner-head">
|
|
4
4
|
<div class="star-ui star-ui-card--inner-title">{{title}}</div>
|
|
5
5
|
<button v-if="collapsible" :class="['star-ui','star-ui-card--inner-button-collapsible',isCollaps?'show':'hidden']" @click="collapsChange"></button>
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<teleport
|
|
3
|
-
<div>
|
|
4
|
-
<div class="star-ui-popper-background" v-if="
|
|
2
|
+
<teleport to="body">
|
|
3
|
+
<div ref="root" :class="['star-ui-base-popper', ...ctrlClass]" :style="{visibility: visible ? '' : 'hidden', ...baseStyle, ...style}">
|
|
4
|
+
<div class="star-ui-popper-background" v-if="isMobile" @click="$emit('out-click')"></div>
|
|
5
5
|
<slot></slot>
|
|
6
6
|
</div>
|
|
7
7
|
</teleport>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script lang="ts">
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { Emit, Prop } from "
|
|
11
|
+
import { Vue } from 'vue-class-component';
|
|
12
|
+
import { SuViewCtrlInjectClassName, SuViewCtrlInjectIsMobile } from "@ui-root/outher";
|
|
13
|
+
import { Emit, Prop, Register } from "@ui-root/reg";
|
|
14
14
|
|
|
15
|
-
import { ViewCtrlInfo } from "../../types";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// import { Vue } from "vue"
|
|
20
15
|
import "../../global-style.css";
|
|
21
16
|
let nowId=0;
|
|
22
17
|
|
|
23
|
-
@
|
|
18
|
+
@Register({
|
|
24
19
|
name:"su-base-popper",
|
|
20
|
+
internalOnly:true,
|
|
25
21
|
props: {
|
|
26
22
|
fromItem:{
|
|
27
23
|
type:Object
|
|
@@ -42,11 +38,18 @@ let nowId=0;
|
|
|
42
38
|
watch:{
|
|
43
39
|
visible(){
|
|
44
40
|
this._updateVisible();
|
|
41
|
+
},
|
|
42
|
+
isMobile(){
|
|
43
|
+
if(this.syncRequestId)cancelAnimationFrame(this.syncRequestId);
|
|
44
|
+
this.updatePos();
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
// inject: ['$suControl']
|
|
48
48
|
})
|
|
49
49
|
export default class SuButton extends Vue {
|
|
50
|
+
declare $refs: {
|
|
51
|
+
root:HTMLDivElement;
|
|
52
|
+
};
|
|
50
53
|
@Prop({
|
|
51
54
|
type:Object
|
|
52
55
|
})
|
|
@@ -55,17 +58,7 @@ export default class SuButton extends Vue {
|
|
|
55
58
|
private id!:string;
|
|
56
59
|
private updateType!:string;
|
|
57
60
|
private visible!:boolean;
|
|
58
|
-
@
|
|
59
|
-
beforeCreate():void{
|
|
60
|
-
this.div=document.createElement("div");
|
|
61
|
-
document.body.append(this.div);
|
|
62
|
-
this.id="star-ui-popper-"+nowId++;
|
|
63
|
-
this.div.id=this.id;
|
|
64
|
-
this.div.style.position="fixed";
|
|
65
|
-
}
|
|
66
|
-
unmounted():void{
|
|
67
|
-
document.body.removeChild(this.div);
|
|
68
|
-
}
|
|
61
|
+
@SuViewCtrlInjectIsMobile readonly isMobile!:false;
|
|
69
62
|
mounted():void{
|
|
70
63
|
window.addEventListener("click",this._clickCheck);
|
|
71
64
|
this._updateVisible();
|
|
@@ -77,7 +70,7 @@ export default class SuButton extends Vue {
|
|
|
77
70
|
_clickCheck(ev:MouseEvent):boolean{
|
|
78
71
|
var dom=ev.target;
|
|
79
72
|
while(dom&&dom!=document){
|
|
80
|
-
if(dom==this.
|
|
73
|
+
if(dom==this.$refs.root||(this.fromItem&&dom==((this.fromItem instanceof HTMLElement)?this.fromItem:this.fromItem.$el))){
|
|
81
74
|
return false;
|
|
82
75
|
}
|
|
83
76
|
dom=(dom as HTMLElement).parentElement;
|
|
@@ -87,24 +80,24 @@ export default class SuButton extends Vue {
|
|
|
87
80
|
private syncRequestId!:number;
|
|
88
81
|
_updateVisible():void{
|
|
89
82
|
if(this.visible){
|
|
90
|
-
this.div.style.display="";
|
|
91
83
|
this.updatePos();
|
|
92
84
|
}else{
|
|
93
|
-
this.div.style.display="none";
|
|
94
85
|
if(this.syncRequestId)cancelAnimationFrame(this.syncRequestId);
|
|
95
86
|
}
|
|
96
87
|
}
|
|
88
|
+
@SuViewCtrlInjectClassName
|
|
89
|
+
readonly ctrlClass!:string[];
|
|
90
|
+
// eslint-disable-next-line
|
|
91
|
+
private baseStyle:Record<string, any>={};
|
|
97
92
|
updatePos():void{
|
|
98
93
|
if(this.fromItem){
|
|
94
|
+
this.baseStyle={};
|
|
99
95
|
let dom=(this.fromItem instanceof HTMLElement)?this.fromItem:this.fromItem.$el;
|
|
100
|
-
if(this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
104
|
-
// this.div.style.height="100%";
|
|
105
|
-
this.div.className="star-ui su-view-control su-view-control-mobile";
|
|
96
|
+
if(this.isMobile){
|
|
97
|
+
this.baseStyle.bottom="0";
|
|
98
|
+
this.baseStyle.left="0";
|
|
99
|
+
this.baseStyle.width="100%";
|
|
106
100
|
}else{
|
|
107
|
-
this.div.className="star-ui su-view-control su-view-control-pc";
|
|
108
101
|
const height=dom.clientHeight;
|
|
109
102
|
let top=0,left=0;
|
|
110
103
|
while(dom&&dom!=document){
|
|
@@ -113,8 +106,8 @@ export default class SuButton extends Vue {
|
|
|
113
106
|
dom=dom.offsetParent;
|
|
114
107
|
}
|
|
115
108
|
top+=height;
|
|
116
|
-
this.
|
|
117
|
-
this.
|
|
109
|
+
this.baseStyle.top=top+"px";
|
|
110
|
+
this.baseStyle.left=left+"px";
|
|
118
111
|
if(this.updateType=="v-sync"){
|
|
119
112
|
this.syncRequestId=requestAnimationFrame(this.updatePos);
|
|
120
113
|
}
|
|
@@ -125,6 +118,9 @@ export default class SuButton extends Vue {
|
|
|
125
118
|
</script>
|
|
126
119
|
|
|
127
120
|
<style>
|
|
121
|
+
.star-ui-base-popper{
|
|
122
|
+
position: fixed;
|
|
123
|
+
}
|
|
128
124
|
.star-ui-popper-background{
|
|
129
125
|
position: fixed;
|
|
130
126
|
width: 100%;
|
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="star-ui su-page">
|
|
3
3
|
<header class="su-ui su-page--header">
|
|
4
|
-
<span v-if="
|
|
4
|
+
<span v-if="isMobile" class="star-ui-icon-font star-ui-icon-menu su-page--mobile-menu-open" @click="isOpenMenu=true" />
|
|
5
5
|
<h1 v-if="title">{{title}}</h1>
|
|
6
6
|
<img v-if="logo" :src="logo" alt="logo" />
|
|
7
7
|
<slot name="header"></slot>
|
|
8
|
-
<div v-if="!
|
|
9
|
-
<su-menu :menu="menu" direction="h"
|
|
8
|
+
<div v-if="!isMobile" class="su-page--menu-box">
|
|
9
|
+
<su-menu :menu="menu" direction="h">
|
|
10
|
+
<template v-if="$slots['menu']" v-slot="item">
|
|
11
|
+
<slot name="menu" v-bind="item" />
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else-if="$slots['menu-text']" v-slot:menu-text="item">
|
|
14
|
+
<slot name="text" v-bind="item" />
|
|
15
|
+
</template>
|
|
16
|
+
</su-menu>
|
|
10
17
|
</div>
|
|
11
18
|
</header>
|
|
12
19
|
<main class="su-ui su-page--main">
|
|
13
20
|
<slot></slot>
|
|
14
21
|
</main>
|
|
15
|
-
<div v-if="
|
|
16
|
-
<su-menu :menu="menu" direction="v" @click.stop
|
|
22
|
+
<div v-if="isMobile" :class="['su-ui', 'su-page--mobile-menu-box', isOpenMenu ? 'su-page--mobile-menu-box-open' : 'su-page--mobile-menu-close']" @click="isOpenMenu=false">
|
|
23
|
+
<su-menu :menu="menu" direction="v" @click.stop>
|
|
24
|
+
<template v-if="$slots['menu']" v-slot="item">
|
|
25
|
+
<slot name="menu" v-bind="item" />
|
|
26
|
+
</template>
|
|
27
|
+
<template v-else-if="$slots['menu-text']" v-slot:menu-text="item">
|
|
28
|
+
<slot name="text" v-bind="item" />
|
|
29
|
+
</template>
|
|
30
|
+
</su-menu>
|
|
17
31
|
</div>
|
|
18
32
|
</div>
|
|
19
33
|
</template>
|
|
20
34
|
|
|
21
35
|
<script lang="ts">
|
|
22
36
|
import { Vue } from "vue-class-component";
|
|
23
|
-
import { Inject } from "vue-property-decorator";
|
|
24
37
|
import { Prop, Register } from "@ui-root/reg";
|
|
25
|
-
import {
|
|
38
|
+
import { SuViewCtrlInjectIsMobile } from "@ui-root/outher";
|
|
26
39
|
import { SuMenu } from "@ui-root/components/menu";
|
|
27
40
|
import { MenuItem } from "@ui-root/types";
|
|
28
|
-
import { ViewCtrlInfo } from "@ui-root/types";
|
|
29
41
|
import "@ui-root/global-style.css";
|
|
30
42
|
|
|
31
43
|
@Register({
|
|
@@ -35,7 +47,7 @@ import "@ui-root/global-style.css";
|
|
|
35
47
|
}
|
|
36
48
|
})
|
|
37
49
|
export default class SuMain extends Vue {
|
|
38
|
-
@
|
|
50
|
+
@SuViewCtrlInjectIsMobile readonly isMobile!:boolean;
|
|
39
51
|
@Prop({
|
|
40
52
|
type: String,
|
|
41
53
|
default: '',
|
|
@@ -79,6 +91,7 @@ export default class SuMain extends Vue {
|
|
|
79
91
|
.su-page--menu-box{
|
|
80
92
|
flex: 1;
|
|
81
93
|
height: 100%;
|
|
94
|
+
z-index: 999999;
|
|
82
95
|
}
|
|
83
96
|
.su-page--menu-box .star-ui-menu-h--chlild-box{
|
|
84
97
|
color: var(--star-ui-font-color);
|
|
@@ -114,4 +127,8 @@ export default class SuMain extends Vue {
|
|
|
114
127
|
.su-page--mobile-menu-close .star-ui-menu-v{
|
|
115
128
|
margin-left: -100%;
|
|
116
129
|
}
|
|
130
|
+
.su-page--main{
|
|
131
|
+
overflow: auto;
|
|
132
|
+
flex: 1;
|
|
133
|
+
}
|
|
117
134
|
</style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`star-ui su-form-item star-ui-form-item star-ui-col-${col} star-ui-form--label-align-${labelAlign||pLabelAlign}`">
|
|
3
|
+
<div ref="labelDiv" class="start-ui star-ui-container star-ui-form-item--label" :style="labelStyle">
|
|
4
|
+
{{label}}
|
|
5
|
+
<slot name="label"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="start-ui star-ui-container star-ui-form-item--content">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { Vue } from "vue-class-component";
|
|
15
|
+
import { Inject } from "vue-property-decorator";
|
|
16
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
17
|
+
import { TypeFormLabelAlign } from "@ui-root/outher";
|
|
18
|
+
import { Bus } from "./form.vue";
|
|
19
|
+
|
|
20
|
+
import "@ui-root/global-style.css";
|
|
21
|
+
|
|
22
|
+
export const InjectLabelWidth = Symbol('InjectLabelWidth');
|
|
23
|
+
export const InjectLabelAlign = Symbol('InjectLabelAlign');
|
|
24
|
+
export const InjectEventBus = Symbol('InjectEventBus');
|
|
25
|
+
|
|
26
|
+
@Register({
|
|
27
|
+
name:"su-form-item",
|
|
28
|
+
hideInDoc:true,
|
|
29
|
+
watch:{
|
|
30
|
+
label(this:SuButton){
|
|
31
|
+
this.bus&&this.bus.labelUpdate(this);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
export default class SuButton extends Vue {
|
|
36
|
+
declare $refs: {
|
|
37
|
+
labelDiv: HTMLDivElement
|
|
38
|
+
};
|
|
39
|
+
@Prop({
|
|
40
|
+
type:String,
|
|
41
|
+
default:()=>{
|
|
42
|
+
return 'label';
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
readonly label!:string;
|
|
46
|
+
@Prop({
|
|
47
|
+
type:[String, Number],
|
|
48
|
+
})
|
|
49
|
+
readonly labelWidth!:string|number|undefined;
|
|
50
|
+
@Inject({from:InjectLabelWidth,default:undefined})
|
|
51
|
+
readonly pLabelWidth!:string|number|undefined;
|
|
52
|
+
@Prop({
|
|
53
|
+
autoType: "FormLabelAlign",
|
|
54
|
+
})
|
|
55
|
+
readonly labelAlign!:TypeFormLabelAlign;
|
|
56
|
+
@Inject({from:InjectLabelAlign,default:"right"})
|
|
57
|
+
readonly pLabelAlign!:TypeFormLabelAlign;
|
|
58
|
+
@Prop({
|
|
59
|
+
type:Number,
|
|
60
|
+
default:()=>{
|
|
61
|
+
return 24;
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
readonly col!:number;
|
|
65
|
+
private get labelStyle():Record<string, unknown>{
|
|
66
|
+
const ret:Record<string, unknown>={};
|
|
67
|
+
const labelWidth = this.labelWidth || this.pLabelWidth;
|
|
68
|
+
if(labelWidth){
|
|
69
|
+
ret.width=typeof labelWidth === 'number' ? `${labelWidth}px` : labelWidth;
|
|
70
|
+
}
|
|
71
|
+
return ret;
|
|
72
|
+
}
|
|
73
|
+
@Inject({from:InjectEventBus})
|
|
74
|
+
readonly bus!:Bus|undefined;
|
|
75
|
+
created(){
|
|
76
|
+
if(this.bus){
|
|
77
|
+
this.bus.addItem(this);
|
|
78
|
+
}
|
|
79
|
+
debugger
|
|
80
|
+
}
|
|
81
|
+
beforeUnmount(){
|
|
82
|
+
if(this.bus){
|
|
83
|
+
this.bus.removeItem(this);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style>
|
|
90
|
+
.star-ui-form-item{
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: row;
|
|
93
|
+
align-items: center;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
}
|
|
96
|
+
.star-ui-form-item--label{
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
box-sizing: border-box;
|
|
99
|
+
}
|
|
100
|
+
.star-ui-form-item--content{
|
|
101
|
+
flex: 1;
|
|
102
|
+
}
|
|
103
|
+
.star-ui-form-item--content>.star-ui-select,.star-ui-form-item--content>.star-ui-input{
|
|
104
|
+
width: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.star-ui-form--label-align-left .star-ui-form-item--label, .star-ui-form--label-align-top .star-ui-form-item--label{
|
|
108
|
+
text-align: left;
|
|
109
|
+
}
|
|
110
|
+
.star-ui-form--label-align-right .star-ui-form-item--label{
|
|
111
|
+
text-align: right;
|
|
112
|
+
}
|
|
113
|
+
.star-ui-form-item.star-ui-form--label-align-top{
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
align-items: stretch;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -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);
|