@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
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thestarweb/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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');
|
|
@@ -1,16 +1,16 @@
|
|
|
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>
|
|
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 {
|
|
@@ -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]" />
|
|
@@ -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,
|
|
@@ -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
|
|
|
@@ -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
|
@@ -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>
|
|
@@ -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
|
};
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<teleport :to="'#'+id">
|
|
3
3
|
<div>
|
|
4
|
-
<div class="star-ui-popper-background" v-if="
|
|
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
|
|
@@ -55,7 +51,7 @@ export default class SuButton extends Vue {
|
|
|
55
51
|
private id!:string;
|
|
56
52
|
private updateType!:string;
|
|
57
53
|
private visible!:boolean;
|
|
58
|
-
@
|
|
54
|
+
@SuViewCtrlInjectIsMobile readonly isMobile!:false;
|
|
59
55
|
beforeCreate():void{
|
|
60
56
|
this.div=document.createElement("div");
|
|
61
57
|
document.body.append(this.div);
|
|
@@ -94,17 +90,19 @@ export default class SuButton extends Vue {
|
|
|
94
90
|
if(this.syncRequestId)cancelAnimationFrame(this.syncRequestId);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
93
|
+
@SuViewCtrlInjectClassName
|
|
94
|
+
readonly ctrlClass!:string[];
|
|
97
95
|
updatePos():void{
|
|
98
96
|
if(this.fromItem){
|
|
99
97
|
let dom=(this.fromItem instanceof HTMLElement)?this.fromItem:this.fromItem.$el;
|
|
100
|
-
if(this.
|
|
98
|
+
if(this.isMobile){
|
|
101
99
|
this.div.style.bottom="0";
|
|
102
100
|
this.div.style.left="0";
|
|
103
101
|
this.div.style.width="100%";
|
|
104
102
|
// this.div.style.height="100%";
|
|
105
|
-
this.div.className=
|
|
103
|
+
this.div.className=this.ctrlClass.join(' ');
|
|
106
104
|
}else{
|
|
107
|
-
this.div.className=
|
|
105
|
+
this.div.className=this.ctrlClass.join(' ');
|
|
108
106
|
const height=dom.clientHeight;
|
|
109
107
|
let top=0,left=0;
|
|
110
108
|
while(dom&&dom!=document){
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SuPage } from "./page.vue";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="star-ui su-page">
|
|
3
|
+
<header class="su-ui su-page--header">
|
|
4
|
+
<span v-if="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="!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>
|
|
17
|
+
</div>
|
|
18
|
+
</header>
|
|
19
|
+
<main class="su-ui su-page--main">
|
|
20
|
+
<slot></slot>
|
|
21
|
+
</main>
|
|
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>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
import { Vue } from "vue-class-component";
|
|
37
|
+
import { Prop, Register } from "@ui-root/reg";
|
|
38
|
+
import { SuViewCtrlInjectIsMobile } from "@ui-root/outher";
|
|
39
|
+
import { SuMenu } from "@ui-root/components/menu";
|
|
40
|
+
import { MenuItem } from "@ui-root/types";
|
|
41
|
+
import "@ui-root/global-style.css";
|
|
42
|
+
|
|
43
|
+
@Register({
|
|
44
|
+
name:"su-page",
|
|
45
|
+
components: {
|
|
46
|
+
SuMenu,
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
export default class SuMain extends Vue {
|
|
50
|
+
@SuViewCtrlInjectIsMobile readonly isMobile!:boolean;
|
|
51
|
+
@Prop({
|
|
52
|
+
type: String,
|
|
53
|
+
default: '',
|
|
54
|
+
})
|
|
55
|
+
private title!:string;
|
|
56
|
+
@Prop({
|
|
57
|
+
type: String,
|
|
58
|
+
default: '',
|
|
59
|
+
})
|
|
60
|
+
private logo!:string;
|
|
61
|
+
@Prop({
|
|
62
|
+
type: Array,
|
|
63
|
+
default: '',
|
|
64
|
+
})
|
|
65
|
+
private menu!:MenuItem[];
|
|
66
|
+
private isOpenMenu = false;
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style>
|
|
71
|
+
.su-page{
|
|
72
|
+
margin: 0;
|
|
73
|
+
padding: 0;
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
}
|
|
79
|
+
.su-page--header{
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
background: #000;
|
|
83
|
+
color: #e6eaf0;
|
|
84
|
+
align-items: center;
|
|
85
|
+
}
|
|
86
|
+
.su-page--header>h1{
|
|
87
|
+
font-size: 20px;
|
|
88
|
+
line-height: 22px;
|
|
89
|
+
padding: 0 20px;
|
|
90
|
+
}
|
|
91
|
+
.su-page--menu-box{
|
|
92
|
+
flex: 1;
|
|
93
|
+
height: 100%;
|
|
94
|
+
z-index: 999999;
|
|
95
|
+
}
|
|
96
|
+
.su-page--menu-box .star-ui-menu-h--chlild-box{
|
|
97
|
+
color: var(--star-ui-font-color);
|
|
98
|
+
}
|
|
99
|
+
.su-page--menu-box .su-menu{
|
|
100
|
+
height: 100%;
|
|
101
|
+
}
|
|
102
|
+
.su-page--mobile-menu-open{
|
|
103
|
+
margin-left: 15px;
|
|
104
|
+
font-size: 20px;
|
|
105
|
+
}
|
|
106
|
+
.su-page--mobile-menu-box{
|
|
107
|
+
position: absolute;
|
|
108
|
+
top: 0;
|
|
109
|
+
left: 0;
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
transition: opacity 0.5s;
|
|
113
|
+
background-color: rgba(128, 128, 128, 0.5);
|
|
114
|
+
}
|
|
115
|
+
.su-page--mobile-menu-close{
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
opacity: 0;
|
|
118
|
+
}
|
|
119
|
+
.su-page--mobile-menu-box .star-ui-menu-v{
|
|
120
|
+
margin-left: 0;
|
|
121
|
+
transition: margin-left 0.5s;
|
|
122
|
+
background-color: var(--star-ui-backgorund-color);
|
|
123
|
+
width: 80%;
|
|
124
|
+
height: 100%;
|
|
125
|
+
border-right: solid 1px var(--star-ui-line-color);
|
|
126
|
+
}
|
|
127
|
+
.su-page--mobile-menu-close .star-ui-menu-v{
|
|
128
|
+
margin-left: -100%;
|
|
129
|
+
}
|
|
130
|
+
.su-page--main{
|
|
131
|
+
overflow: auto;
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -0,0 +1,96 @@
|
|
|
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 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
|
+
|
|
19
|
+
import "@ui-root/global-style.css";
|
|
20
|
+
|
|
21
|
+
export const InjectLabelWidth = Symbol('InjectLabelWidth');
|
|
22
|
+
export const InjectLabelAlign = Symbol('InjectLabelAlign');
|
|
23
|
+
|
|
24
|
+
@Register({
|
|
25
|
+
name:"su-form-item",
|
|
26
|
+
hideInDoc:true,
|
|
27
|
+
})
|
|
28
|
+
export default class SuButton extends Vue {
|
|
29
|
+
@Prop({
|
|
30
|
+
type:String,
|
|
31
|
+
default:()=>{
|
|
32
|
+
return 'label';
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
readonly label!:string;
|
|
36
|
+
@Prop({
|
|
37
|
+
type:[String, Number],
|
|
38
|
+
})
|
|
39
|
+
readonly labelWidth!:string|number|undefined;
|
|
40
|
+
@Inject({from:InjectLabelWidth})
|
|
41
|
+
readonly pLabelWidth!:string|number|undefined;
|
|
42
|
+
@Prop({
|
|
43
|
+
autoType: "FormLabelAlign",
|
|
44
|
+
})
|
|
45
|
+
readonly labelAlign!:TypeFormLabelAlign;
|
|
46
|
+
@Inject({from:InjectLabelAlign,default:"right"})
|
|
47
|
+
readonly pLabelAlign!:TypeFormLabelAlign;
|
|
48
|
+
@Prop({
|
|
49
|
+
type:Number,
|
|
50
|
+
default:()=>{
|
|
51
|
+
return 24;
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
readonly col!:number;
|
|
55
|
+
private get labelStyle():Record<string, unknown>{
|
|
56
|
+
const ret:Record<string, unknown>={};
|
|
57
|
+
const labelWidth = this.labelWidth || this.pLabelWidth;
|
|
58
|
+
if(labelWidth){
|
|
59
|
+
ret.width=typeof labelWidth === 'number' ? `${labelWidth}px` : labelWidth;
|
|
60
|
+
}
|
|
61
|
+
return ret;
|
|
62
|
+
}
|
|
63
|
+
created(){
|
|
64
|
+
console.log(this.col);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<style>
|
|
70
|
+
.star-ui-form-item{
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
align-items: center;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
}
|
|
76
|
+
.star-ui-form-item--label{
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
}
|
|
79
|
+
.star-ui-form-item--content{
|
|
80
|
+
flex: 1;
|
|
81
|
+
}
|
|
82
|
+
.star-ui-form-item--content>.star-ui-select,.star-ui-form-item--content>.star-ui-input{
|
|
83
|
+
width: 100%;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.star-ui-form--label-align-left .star-ui-form-item--label, .star-ui-form--label-align-top .star-ui-form-item--label{
|
|
87
|
+
text-align: left;
|
|
88
|
+
}
|
|
89
|
+
.star-ui-form--label-align-right .star-ui-form-item--label{
|
|
90
|
+
text-align: right;
|
|
91
|
+
}
|
|
92
|
+
.star-ui-form-item.star-ui-form--label-align-top{
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
align-items: stretch;
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|
|
12
|
+
import "@ui-root/global-style.css";
|
|
13
|
+
import { Provide } from "vue-property-decorator";
|
|
14
|
+
import { InjectLabelAlign, InjectLabelWidth } from "./form-item.vue";
|
|
15
|
+
|
|
16
|
+
@Register({
|
|
17
|
+
name:"su-form"
|
|
18
|
+
})
|
|
19
|
+
export default class SuButton extends Vue {
|
|
20
|
+
@Prop({
|
|
21
|
+
autoType: "FormLabelAlign",
|
|
22
|
+
default:()=>{
|
|
23
|
+
return "right"
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
@Provide({to:InjectLabelAlign})
|
|
27
|
+
readonly labelAlign!:TypeFormLabelAlign;
|
|
28
|
+
@Prop({
|
|
29
|
+
type: Number
|
|
30
|
+
})
|
|
31
|
+
@Provide({to:InjectLabelWidth})
|
|
32
|
+
readonly labelWidth!:number|undefined;
|
|
33
|
+
@Prop({
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default:()=>{
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
readonly allowAotoMobile!:boolean;
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
<style>
|
|
43
|
+
.star-ui-form{
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
}
|
|
48
|
+
.star-ui-view-control.star-ui-view-control-mobile .star-ui-form--auto-mobile>.star-ui-form-item{
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./form/index";
|
package/src/components/input.vue
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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>
|
|
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 {
|
|
@@ -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>
|
|
@@ -1,24 +1,23 @@
|
|
|
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>
|
|
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
|
}
|
|
18
17
|
</script>
|
|
19
18
|
|
|
20
19
|
<style>
|
|
21
|
-
.
|
|
20
|
+
.star-ui-h-layout{
|
|
22
21
|
display: flex;
|
|
23
22
|
flex-direction: row;
|
|
24
23
|
width: 100%;
|
|
@@ -26,10 +25,10 @@ export default class SuHLayout extends Vue {
|
|
|
26
25
|
padding: 0;
|
|
27
26
|
overflow: hidden;
|
|
28
27
|
}
|
|
29
|
-
.
|
|
28
|
+
.star-ui-h-layout>*{
|
|
30
29
|
flex:0 0 auto;
|
|
31
30
|
}
|
|
32
|
-
.
|
|
31
|
+
.star-ui-h-layout>.star-ui-main{
|
|
33
32
|
width: 0;
|
|
34
33
|
}
|
|
35
34
|
</style>
|
|
@@ -1,14 +1,15 @@
|
|
|
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>
|
|
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
|
}
|
|
@@ -18,7 +19,7 @@ export default class SuMain extends Vue {
|
|
|
18
19
|
</script>
|
|
19
20
|
|
|
20
21
|
<style>
|
|
21
|
-
.
|
|
22
|
+
.star-ui-main{
|
|
22
23
|
flex: 1;
|
|
23
24
|
}
|
|
24
25
|
</style>
|
|
@@ -1,14 +1,15 @@
|
|
|
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>
|
|
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
|
}
|
|
@@ -18,7 +19,7 @@ export default class SuVLayout extends Vue {
|
|
|
18
19
|
</script>
|
|
19
20
|
|
|
20
21
|
<style>
|
|
21
|
-
.
|
|
22
|
+
.star-ui-v-layout{
|
|
22
23
|
display: flex;
|
|
23
24
|
flex-direction: column;
|
|
24
25
|
width: 100%;
|
|
@@ -26,10 +27,10 @@ export default class SuVLayout extends Vue {
|
|
|
26
27
|
padding: 0;
|
|
27
28
|
overflow: hidden;
|
|
28
29
|
}
|
|
29
|
-
.
|
|
30
|
+
.star-ui-v-layout>*{
|
|
30
31
|
flex:0 0 auto;
|
|
31
32
|
}
|
|
32
|
-
.
|
|
33
|
+
.star-ui-v-layout>.star-ui-main{
|
|
33
34
|
height: 0;
|
|
34
35
|
}
|
|
35
36
|
</style>
|