@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/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>
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script lang="ts">
|
|
20
|
-
import {
|
|
21
|
-
import { Prop } from "
|
|
20
|
+
import { Vue } from 'vue-class-component';
|
|
21
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
22
22
|
import "../global-style.css";
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
@
|
|
25
|
+
@Register({
|
|
26
26
|
name:"su-table",
|
|
27
27
|
props: {
|
|
28
28
|
data:{
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="[
|
|
3
3
|
'star-ui',
|
|
4
|
+
'su-tree',
|
|
4
5
|
'star-ui-tree',
|
|
5
6
|
{
|
|
6
7
|
'star-ui-tree-highlight-current':highlightCurrent
|
|
@@ -11,14 +12,14 @@
|
|
|
11
12
|
</template>
|
|
12
13
|
|
|
13
14
|
<script lang="ts">
|
|
14
|
-
import {
|
|
15
|
-
import { Prop } from "
|
|
15
|
+
import { Vue } from 'vue-class-component';
|
|
16
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
16
17
|
import treeItem from "./tree-item.vue"
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
import "../../global-style.css";
|
|
20
21
|
|
|
21
|
-
@
|
|
22
|
+
@Register({
|
|
22
23
|
name:"su-tree",
|
|
23
24
|
components:{
|
|
24
25
|
treeItem
|
|
@@ -22,18 +22,19 @@
|
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script lang="ts">
|
|
25
|
-
import {
|
|
26
|
-
import { Prop } from "
|
|
25
|
+
import { Vue } from 'vue-class-component';
|
|
26
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
27
27
|
import treeItem from "./tree-item.vue"
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
import "../../global-style.css";
|
|
31
31
|
|
|
32
|
-
@
|
|
32
|
+
@Register({
|
|
33
33
|
name:"su-tree-item",
|
|
34
34
|
components:{
|
|
35
35
|
treeItem
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
internalOnly: true,
|
|
37
38
|
})
|
|
38
39
|
export default class SuTreeItem extends Vue {
|
|
39
40
|
readonly isExpand=false;
|
|
@@ -1,47 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="['star-ui',
|
|
2
|
+
<div :class="['star-ui', className]">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import {
|
|
9
|
-
import { InjectionKey } from 'vue';
|
|
8
|
+
import { Vue } from 'vue-class-component';
|
|
10
9
|
|
|
11
|
-
import { Prop } from "
|
|
10
|
+
import { Register, Prop } from "@ui-root/reg";
|
|
11
|
+
import { SuViewCtrlInjectKeyClassName, SuViewCtrlInjectKeyIsMobile } from "@ui-root/outher";
|
|
12
12
|
import { Provide } from "vue-property-decorator";
|
|
13
|
-
|
|
14
|
-
import { ViewCtrlInfo } from "../types";
|
|
15
13
|
import "../global-style.css";
|
|
16
14
|
|
|
17
15
|
type DeviceType='auto'|'mobile'|'pc';
|
|
18
16
|
|
|
19
17
|
|
|
20
|
-
@
|
|
18
|
+
@Register({
|
|
21
19
|
name:"su-view-control",
|
|
22
|
-
watch:{
|
|
23
|
-
$isMobile(newValue){
|
|
24
|
-
this.sendData.isMobile = newValue;
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
provide() {
|
|
28
|
-
return {
|
|
29
|
-
viewCtrlInfo: this.sendData
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
created(){
|
|
33
|
-
this.sendData.isMobile = this.$isMobile;
|
|
34
|
-
}
|
|
35
20
|
})
|
|
36
21
|
export default class SuViewControl extends Vue {
|
|
37
|
-
public static readonly injectSymbol=Symbol();
|
|
38
22
|
mounted():void{
|
|
39
23
|
this.$el._vue = this;
|
|
40
24
|
}
|
|
41
|
-
@Provide({to:SuViewControl.injectSymbol})
|
|
42
|
-
private sendData:ViewCtrlInfo={
|
|
43
|
-
isMobile:false
|
|
44
|
-
}
|
|
45
25
|
@Prop({
|
|
46
26
|
type: String,
|
|
47
27
|
default: "auto",
|
|
@@ -64,6 +44,7 @@ export default class SuViewControl extends Vue {
|
|
|
64
44
|
this.windowWidth = window.innerWidth;
|
|
65
45
|
this.windowHeight = window.innerHeight;
|
|
66
46
|
}
|
|
47
|
+
@Provide({to:SuViewCtrlInjectKeyIsMobile})
|
|
67
48
|
public get $isMobile():boolean{
|
|
68
49
|
switch (this.deviceType) {
|
|
69
50
|
case "mobile":
|
|
@@ -75,10 +56,27 @@ export default class SuViewControl extends Vue {
|
|
|
75
56
|
case "ua":
|
|
76
57
|
return navigator.userAgent.toLowerCase().indexOf("mobile")!=-1;
|
|
77
58
|
case "screen-width":
|
|
59
|
+
console.log(this.windowWidth);
|
|
78
60
|
return this.windowWidth < 1000;
|
|
79
61
|
}
|
|
80
62
|
return false;
|
|
81
63
|
}
|
|
64
|
+
@Provide({to:SuViewCtrlInjectKeyClassName})
|
|
65
|
+
public get className():string[]{
|
|
66
|
+
return [
|
|
67
|
+
'su-view-control',
|
|
68
|
+
'star-ui-view-control',
|
|
69
|
+
`star-ui-view-control-${this.$isMobile?'mobile':'pc'}`,
|
|
70
|
+
`su-view-control-${this.$isMobile?'mobile':'pc'}`
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
beforeMount(){
|
|
74
|
+
this.checkWindowSize();
|
|
75
|
+
window.addEventListener("resize", this.checkWindowSize);
|
|
76
|
+
}
|
|
77
|
+
beforeUnmount(){
|
|
78
|
+
window.removeEventListener("resize", this.checkWindowSize);
|
|
79
|
+
}
|
|
82
80
|
}
|
|
83
81
|
</script>
|
|
84
82
|
|
package/src/global-style.css
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
:root{
|
|
2
2
|
/*背景颜色*/
|
|
3
3
|
--star-ui-backgorund-color:#FFF;
|
|
4
|
+
/*背景颜色*/
|
|
5
|
+
--star-ui-font-color:#222;
|
|
4
6
|
/*表格头*/
|
|
5
7
|
--star-ui-table-head-color:#f8f8f9;
|
|
6
8
|
/*基础颜色*/
|
|
@@ -30,6 +32,7 @@
|
|
|
30
32
|
margin:0;
|
|
31
33
|
padding: 0;
|
|
32
34
|
position: relative;
|
|
35
|
+
box-sizing: border-box;
|
|
33
36
|
}
|
|
34
37
|
/*内容容器大大小*/
|
|
35
38
|
.star-ui-container{
|
|
@@ -47,4 +50,76 @@
|
|
|
47
50
|
line-height: var(--star-ui-input-mini-font-size);
|
|
48
51
|
padding: calc(var(--star-ui-default-padding) / 2);
|
|
49
52
|
border-radius: calc(var(--star-ui-border-radius) / 2);
|
|
50
|
-
}
|
|
53
|
+
}
|
|
54
|
+
.star-ui-col-1{
|
|
55
|
+
width: calc(100% / 24 * 1);
|
|
56
|
+
}
|
|
57
|
+
.star-ui-col-2{
|
|
58
|
+
width: calc(100% / 24 * 2);
|
|
59
|
+
}
|
|
60
|
+
.star-ui-col-3{
|
|
61
|
+
width: calc(100% / 24 * 3);
|
|
62
|
+
}
|
|
63
|
+
.star-ui-col-4{
|
|
64
|
+
width: calc(100% / 24 * 4);
|
|
65
|
+
}
|
|
66
|
+
.star-ui-col-5{
|
|
67
|
+
width: calc(100% / 24 * 5);
|
|
68
|
+
}
|
|
69
|
+
.star-ui-col-6{
|
|
70
|
+
width: calc(100% / 24 * 6);
|
|
71
|
+
}
|
|
72
|
+
.star-ui-col-7{
|
|
73
|
+
width: calc(100% / 24 * 7);
|
|
74
|
+
}
|
|
75
|
+
.star-ui-col-8{
|
|
76
|
+
width: calc(100% / 24 * 8);
|
|
77
|
+
}
|
|
78
|
+
.star-ui-col-9{
|
|
79
|
+
width: calc(100% / 24 * 9);
|
|
80
|
+
}
|
|
81
|
+
.star-ui-col-10{
|
|
82
|
+
width: calc(100% / 24 * 10);
|
|
83
|
+
}
|
|
84
|
+
.star-ui-col-11{
|
|
85
|
+
width: calc(100% / 24 * 11);
|
|
86
|
+
}
|
|
87
|
+
.star-ui-col-12{
|
|
88
|
+
width: calc(100% / 24 * 12);
|
|
89
|
+
}
|
|
90
|
+
.star-ui-col-13{
|
|
91
|
+
width: calc(100% / 24 * 13);
|
|
92
|
+
}
|
|
93
|
+
.star-ui-col-14{
|
|
94
|
+
width: calc(100% / 24 * 14);
|
|
95
|
+
}
|
|
96
|
+
.star-ui-col-15{
|
|
97
|
+
width: calc(100% / 24 * 15);
|
|
98
|
+
}
|
|
99
|
+
.star-ui-col-16{
|
|
100
|
+
width: calc(100% / 24 * 16);
|
|
101
|
+
}
|
|
102
|
+
.star-ui-col-17{
|
|
103
|
+
width: calc(100% / 24 * 17);
|
|
104
|
+
}
|
|
105
|
+
.star-ui-col-18{
|
|
106
|
+
width: calc(100% / 24 * 18);
|
|
107
|
+
}
|
|
108
|
+
.star-ui-col-19{
|
|
109
|
+
width: calc(100% / 24 * 19);
|
|
110
|
+
}
|
|
111
|
+
.star-ui-col-20{
|
|
112
|
+
width: calc(100% / 24 * 20);
|
|
113
|
+
}
|
|
114
|
+
.star-ui-col-21{
|
|
115
|
+
width: calc(100% / 24 * 22);
|
|
116
|
+
}
|
|
117
|
+
.star-ui-col-22{
|
|
118
|
+
width: calc(100% / 24 * 22);
|
|
119
|
+
}
|
|
120
|
+
.star-ui-col-23{
|
|
121
|
+
width: calc(100% / 24 * 23);
|
|
122
|
+
}
|
|
123
|
+
.star-ui-col-24{
|
|
124
|
+
width: calc(100% / 24 * 24);
|
|
125
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
|
|
3
|
-
src: url('iconfont.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
url('iconfont.ttf?t=1618646407015') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
|
|
7
|
-
url('iconfont.svg?t=1618646407015#star-ui-iconfont') format('svg'); /* iOS 4.1- */
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "star-ui-iconfont"; /* Project id 2493685 */
|
|
3
|
+
src: url('iconfont.woff2?t=1636814190896') format('woff2'),
|
|
4
|
+
url('iconfont.woff?t=1636814190896') format('woff'),
|
|
5
|
+
url('iconfont.ttf?t=1636814190896') format('truetype');
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
.star-ui-icon-font {
|
|
@@ -15,6 +13,18 @@
|
|
|
15
13
|
-moz-osx-font-smoothing: grayscale;
|
|
16
14
|
}
|
|
17
15
|
|
|
16
|
+
.star-ui-icon-menu:before {
|
|
17
|
+
content: "\e65f";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.star-ui-icon-add:before {
|
|
21
|
+
content: "\e6da";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.star-ui-icon-home:before {
|
|
25
|
+
content: "\e6b8";
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
.star-ui-icon-code:before {
|
|
19
29
|
content: "\e667";
|
|
20
30
|
}
|
|
@@ -2,9 +2,30 @@
|
|
|
2
2
|
"id": "2493685",
|
|
3
3
|
"name": "star-ui",
|
|
4
4
|
"font_family": "star-ui-iconfont",
|
|
5
|
-
"css_prefix_text": "star-ui-icon",
|
|
5
|
+
"css_prefix_text": "star-ui-icon-",
|
|
6
6
|
"description": "",
|
|
7
7
|
"glyphs": [
|
|
8
|
+
{
|
|
9
|
+
"icon_id": "1251228",
|
|
10
|
+
"name": "menu",
|
|
11
|
+
"font_class": "menu",
|
|
12
|
+
"unicode": "e65f",
|
|
13
|
+
"unicode_decimal": 58975
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"icon_id": "38747",
|
|
17
|
+
"name": "add",
|
|
18
|
+
"font_class": "add",
|
|
19
|
+
"unicode": "e6da",
|
|
20
|
+
"unicode_decimal": 59098
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"icon_id": "33516",
|
|
24
|
+
"name": "home",
|
|
25
|
+
"font_class": "home",
|
|
26
|
+
"unicode": "e6b8",
|
|
27
|
+
"unicode_decimal": 59064
|
|
28
|
+
},
|
|
8
29
|
{
|
|
9
30
|
"icon_id": "15838443",
|
|
10
31
|
"name": "code",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/main.ts
CHANGED
|
@@ -1,37 +1,50 @@
|
|
|
1
1
|
//布局
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export { default as SuHLayout } from "./components/layout-h.vue";
|
|
3
|
+
export { default as SuVLayout } from "./components/layout-v.vue";
|
|
4
|
+
export { default as SuMain } from "./components/layout-main.vue";
|
|
5
|
+
export { default as SuTable } from "./components/table.vue";
|
|
6
|
+
export { default as SuHLine } from "./components/line-h.vue";
|
|
7
|
+
export { default as SuVLine } from "./components/line-v.vue";
|
|
8
|
+
export { default as SuCard } from "./components/card.vue";
|
|
9
|
+
export { default as SuTree } from "./components/tree/index.vue";
|
|
10
10
|
//表单
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export * from "./components/form";
|
|
12
|
+
export { default as SuInput } from "./components/input.vue";
|
|
13
|
+
export { default as SuSelect } from "./components/select.vue";
|
|
14
|
+
export { default as SuButton } from "./components/button.vue";
|
|
15
|
+
export { default as SuSwitch } from "./components/switch.vue";
|
|
16
|
+
export { default as SuSlider } from "./components/slider.vue";
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
export { default as SuCalendar } from "./components/calendar.vue";
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
export { default as SuViewControl } from "./components/view-control.vue";
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
export * from "./components/menu";
|
|
24
|
+
export * from "./components/content";
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
import { data } from "./reg";
|
|
27
|
+
export * from "./outher";
|
|
28
|
+
|
|
29
|
+
import { App, readonly } from "vue";
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line
|
|
32
|
+
export const components:Record<string,any>={};
|
|
33
|
+
Object.keys(data).map((key) => {
|
|
34
|
+
if(data[key].component&&!data[key].internalOnly){
|
|
35
|
+
components[key]=data[key].component;
|
|
33
36
|
}
|
|
37
|
+
});
|
|
38
|
+
export const allData = readonly(data);
|
|
39
|
+
|
|
40
|
+
const registComponents=function(app:App):void{
|
|
41
|
+
Object.keys(data).map((key) => {
|
|
42
|
+
if(data[key].component&&!data[key].internalOnly){
|
|
43
|
+
app.component(components[key].__o.name,components[key]);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
34
46
|
}
|
|
47
|
+
export const infos = readonly(data);
|
|
35
48
|
export default {
|
|
36
49
|
...components,
|
|
37
50
|
components,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Inject } from "vue-property-decorator";
|
|
2
|
+
|
|
3
|
+
export const SuViewCtrlInjectKeyIsMobile=Symbol('SuViewCtrlInjectKeyIsMobile');
|
|
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;
|
package/src/reg.ts
CHANGED
|
@@ -1,14 +1,42 @@
|
|
|
1
|
-
import { VueDecorator, PropOptions, createDecorator } from
|
|
2
|
-
import { reactive } from
|
|
1
|
+
import { VueDecorator, PropOptions, createDecorator, Vue, VueConstructor, VueBase } from "vue-class-component";
|
|
2
|
+
import { ComponentOptions, PropType, reactive } from "vue";
|
|
3
|
+
interface ComponentInfo{
|
|
4
|
+
hideInDoc?:boolean;
|
|
5
|
+
internalOnly?:boolean;
|
|
6
|
+
type?:'from'|'layout';
|
|
7
|
+
}
|
|
3
8
|
|
|
9
|
+
const AutoTypes = {
|
|
10
|
+
FormLabelAlign: {
|
|
11
|
+
allow: ['left','right','top'],
|
|
12
|
+
type: String,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
4
15
|
|
|
5
16
|
export const data = reactive({
|
|
6
17
|
//
|
|
7
18
|
} as {[key:string]: {
|
|
8
19
|
props?:{
|
|
9
20
|
[key:string]: PropOptions
|
|
21
|
+
};
|
|
22
|
+
component?:VueConstructor<VueBase>;
|
|
23
|
+
}&ComponentInfo});
|
|
24
|
+
|
|
25
|
+
export type RegisterOptions<V> = ComponentOptions & ThisType<V> & ComponentInfo;
|
|
26
|
+
export function Register<V extends Vue>({ hideInDoc, internalOnly, ...options }:RegisterOptions<V>):<VC extends VueConstructor<VueBase>>(target: VC) => VC{
|
|
27
|
+
return (Component) => {
|
|
28
|
+
if(options.name){
|
|
29
|
+
if(!data[options.name]) data[options.name] = {};
|
|
30
|
+
// eslint-disable-next-line
|
|
31
|
+
data[options.name].component = Component;
|
|
32
|
+
data[options.name].hideInDoc = hideInDoc;
|
|
33
|
+
data[options.name].internalOnly = internalOnly;
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line
|
|
36
|
+
(Component as any).__o = options
|
|
37
|
+
return Component
|
|
10
38
|
}
|
|
11
|
-
}
|
|
39
|
+
}
|
|
12
40
|
|
|
13
41
|
const hyphenate = (str:string) => str.replace(/\B([A-Z])/g, '-$1').toLowerCase();
|
|
14
42
|
// eslint-disable-next-line
|
|
@@ -59,16 +87,43 @@ export function Emit(event?:string, shouldEmit?:(res:any)=>boolean):VueDecorator
|
|
|
59
87
|
});
|
|
60
88
|
}
|
|
61
89
|
|
|
62
|
-
|
|
90
|
+
interface RegPropOptions<T = any, D = T> extends PropOptions<T>{
|
|
91
|
+
autoType?: keyof typeof AutoTypes;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
function checkPropInAllow(list:any[]){
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
return function(value:any){
|
|
98
|
+
return list.includes(value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export function Prop({ autoType , ...propOptions}:RegPropOptions):VueDecorator{
|
|
63
102
|
return createDecorator((componentOptions, key) => {
|
|
64
103
|
if(componentOptions.name){
|
|
65
|
-
// console.log(componentOptions.name);
|
|
66
104
|
if(!data[componentOptions.name]) data[componentOptions.name] = {};
|
|
67
105
|
if(!data[componentOptions.name].props) data[componentOptions.name].props={};
|
|
68
106
|
// eslint-disable-next-line
|
|
69
107
|
(data[componentOptions.name].props!)[key] = propOptions;
|
|
70
108
|
}
|
|
109
|
+
const eData:PropOptions = {};
|
|
110
|
+
if(autoType){
|
|
111
|
+
const autoTypeData = AutoTypes[autoType];
|
|
112
|
+
if(autoTypeData.type){
|
|
113
|
+
eData.type = autoTypeData.type;
|
|
114
|
+
}
|
|
115
|
+
const validator = [];
|
|
116
|
+
if(autoTypeData.allow){
|
|
117
|
+
validator.push(checkPropInAllow(autoTypeData.allow))
|
|
118
|
+
}
|
|
119
|
+
if(validator.length === 1){
|
|
120
|
+
eData.validator = validator[0];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
71
123
|
if(!componentOptions.props) componentOptions.props={};
|
|
72
|
-
componentOptions.props[key] =
|
|
124
|
+
componentOptions.props[key] = {
|
|
125
|
+
...eData,
|
|
126
|
+
...propOptions
|
|
127
|
+
};
|
|
73
128
|
});
|
|
74
|
-
}
|
|
129
|
+
}
|
package/src/types.d.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Vue } from "vue-class-component";
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
import "../global-style.css";
|
|
4
|
+
interface DateBaseInfo {
|
|
5
|
+
display: number;
|
|
6
|
+
isPrevious: boolean;
|
|
7
|
+
isNext: boolean;
|
|
8
|
+
week: string;
|
|
9
|
+
date: moment.Moment;
|
|
10
|
+
}
|
|
11
|
+
export default class SuCalendar extends Vue {
|
|
12
|
+
readonly displayMonth: Date | string;
|
|
13
|
+
private dYear;
|
|
14
|
+
private dMonth;
|
|
15
|
+
private get displayMonthDate();
|
|
16
|
+
readonly weekName: string[];
|
|
17
|
+
weekOffect: number;
|
|
18
|
+
private get displayHead();
|
|
19
|
+
private get displayData();
|
|
20
|
+
readonly renderCell: (arg: DateBaseInfo) => unknown;
|
|
21
|
+
private showSelYear;
|
|
22
|
+
private dShowSelYear;
|
|
23
|
+
private showSelMonth;
|
|
24
|
+
private dateClick;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Vue } from 'vue-class-component';
|
|
2
|
+
import "../global-style.css";
|
|
3
|
+
export default class SuCard extends Vue {
|
|
4
|
+
$refs: {
|
|
5
|
+
body: HTMLDivElement;
|
|
6
|
+
bodyInner: HTMLDivElement;
|
|
7
|
+
};
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly collapsible: boolean;
|
|
10
|
+
isCollaps: boolean;
|
|
11
|
+
collapsChange(): void;
|
|
12
|
+
handleTransitionEnd(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Vue } from 'vue-class-component';
|
|
2
|
+
import "../../global-style.css";
|
|
3
|
+
export default class SuButton extends Vue {
|
|
4
|
+
fromItem: Vue | HTMLElement;
|
|
5
|
+
private div;
|
|
6
|
+
private id;
|
|
7
|
+
private updateType;
|
|
8
|
+
private visible;
|
|
9
|
+
readonly isMobile: false;
|
|
10
|
+
beforeCreate(): void;
|
|
11
|
+
unmounted(): void;
|
|
12
|
+
mounted(): void;
|
|
13
|
+
beforeUnmount(): void;
|
|
14
|
+
_clickCheck(ev: MouseEvent): boolean;
|
|
15
|
+
private syncRequestId;
|
|
16
|
+
_updateVisible(): void;
|
|
17
|
+
readonly ctrlClass: string[];
|
|
18
|
+
updatePos(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SuPage } from "./page.vue";
|