@thestarweb/ui 1.4.2 → 1.5.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.
Files changed (75) hide show
  1. package/build-ts/main.js +24 -4
  2. package/dist/star-ui.common.js +1494 -726
  3. package/dist/star-ui.common.js.map +1 -1
  4. package/dist/star-ui.umd.js +1494 -726
  5. package/dist/star-ui.umd.js.map +1 -1
  6. package/dist/star-ui.umd.min.js +71 -71
  7. package/dist/star-ui.umd.min.js.map +1 -1
  8. package/package.json +2 -2
  9. package/readme.md +2 -2
  10. package/src/components/button.vue +3 -3
  11. package/src/components/calendar.vue +3 -3
  12. package/src/components/call-render.tsx +4 -3
  13. package/src/components/card.vue +4 -4
  14. package/src/components/content/index.ts +1 -0
  15. package/src/components/content/page.vue +117 -0
  16. package/src/components/input.vue +3 -3
  17. package/src/components/layout-h.vue +3 -4
  18. package/src/components/layout-main.vue +3 -2
  19. package/src/components/layout-v.vue +3 -2
  20. package/src/components/line-h.vue +9 -8
  21. package/src/components/line-v.vue +9 -8
  22. package/src/components/menu/index.ts +1 -0
  23. package/src/components/menu/index.vue +83 -0
  24. package/src/components/menu/menu-h/index.vue +66 -0
  25. package/src/components/menu/menu-h/menu-h-child.vue +74 -0
  26. package/src/components/menu/menu-h/menu-h-item.vue +65 -0
  27. package/src/components/menu/menu-v/index.vue +56 -0
  28. package/src/components/select.vue +3 -3
  29. package/src/components/slider.vue +3 -3
  30. package/src/components/switch.vue +43 -43
  31. package/src/components/table.vue +3 -3
  32. package/src/components/tree/index.vue +3 -3
  33. package/src/components/tree/tree-item.vue +5 -4
  34. package/src/components/view-control.vue +3 -4
  35. package/src/directives/is-focus.ts +10 -0
  36. package/src/global-style.css +3 -0
  37. package/src/icon-font/iconfont.css +17 -7
  38. package/src/icon-font/iconfont.json +22 -1
  39. package/src/icon-font/iconfont.ttf +0 -0
  40. package/src/icon-font/iconfont.woff +0 -0
  41. package/src/icon-font/iconfont.woff2 +0 -0
  42. package/src/main.ts +36 -25
  43. package/src/reg.ts +26 -6
  44. package/src/types.d.ts +6 -0
  45. package/src/utils.ts +1 -1
  46. package/types/components/button.vue.d.ts +5 -0
  47. package/types/components/calendar.vue.d.ts +26 -0
  48. package/types/components/card.vue.d.ts +13 -0
  49. package/types/components/common/base-popper.vue.d.ts +19 -0
  50. package/types/components/content/index.d.ts +1 -0
  51. package/types/components/content/page.vue.d.ts +10 -0
  52. package/types/components/input.vue.d.ts +15 -0
  53. package/types/components/layout-h.vue.d.ts +4 -0
  54. package/types/components/layout-main.vue.d.ts +4 -0
  55. package/types/components/layout-v.vue.d.ts +4 -0
  56. package/types/components/line-h.vue.d.ts +4 -0
  57. package/types/components/line-v.vue.d.ts +4 -0
  58. package/types/components/menu/index.d.ts +1 -0
  59. package/types/components/menu/index.vue.d.ts +12 -0
  60. package/types/components/menu/menu-h/index.vue.d.ts +8 -0
  61. package/types/components/menu/menu-h/menu-h-child.vue.d.ts +7 -0
  62. package/types/components/menu/menu-h/menu-h-item.vue.d.ts +8 -0
  63. package/types/components/menu/menu-v/index.vue.d.ts +9 -0
  64. package/types/components/select.vue.d.ts +27 -0
  65. package/types/components/slider.vue.d.ts +29 -0
  66. package/types/components/switch.vue.d.ts +12 -0
  67. package/types/components/table.vue.d.ts +5 -0
  68. package/types/components/tree/index.vue.d.ts +15 -0
  69. package/types/components/tree/tree-item.vue.d.ts +18 -0
  70. package/types/components/view-control.vue.d.ts +15 -0
  71. package/types/directives/is-focus.d.ts +4 -0
  72. package/types/main.d.ts +68 -6
  73. package/types/reg.d.ts +14 -1
  74. package/dist/img/iconfont.ff1d7f50.svg +0 -62
  75. package/types/utils.d.ts +0 -3
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div :class="['star-ui', 'star-ui-menu', 'star-ui-menu-v']">
3
+ <div>
4
+ <span @click="handlePathClick(0)"><span class="star-ui-icon-font star-ui-icon-home" />&gt;</span>
5
+ <span v-for="(item,index) in path" :key="`${index}-${item.path||'nopath'}`" @click="handlePathClick(index+1)">
6
+ {{item.title}}&gt;
7
+ </span>
8
+ </div>
9
+ <div v-for="item in current" :key="item.path" @click="handleItemClick(item)">
10
+ <slot v-bind="item" />
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { Register, Prop } from "@ui-root/reg";
17
+ import { Vue } from 'vue-class-component';
18
+ import { MenuItem } from "@ui-root/types";
19
+ import '@ui-root/global-style.css';
20
+
21
+ @Register({
22
+ name: 'su-h-menu',
23
+ internalOnly:true,
24
+ })
25
+ export default class SuHMenu extends Vue {
26
+ @Prop({
27
+ type: Array,
28
+ required: true,
29
+ })
30
+ private menu!:MenuItem[];
31
+ private path:MenuItem[]=[];
32
+ private get current():MenuItem[]{
33
+ if(this.path.length == 0){
34
+ return this.menu;
35
+ }
36
+ const item = this.path[this.path.length-1];
37
+ const res = [...(item.children || [])];
38
+ if(item.path){
39
+ res.unshift(item);
40
+ }
41
+ return res;
42
+ }
43
+ private handlePathClick(index:number){
44
+ this.path = this.path.slice(0,index);
45
+ }
46
+ private handleItemClick(item:MenuItem, ev:MouseEvent){
47
+ if(item.children && item.children.length > 0 && (this.path.length==0 || item!=this.path[this.path.length-1])){
48
+ this.path.push(item);
49
+ }
50
+ }
51
+ }
52
+
53
+ </script>
54
+ <style>
55
+
56
+ </style>
@@ -26,10 +26,10 @@
26
26
  </template>
27
27
 
28
28
  <script lang="ts">
29
- import { Options, Vue } from 'vue-class-component';
29
+ import { Vue } from 'vue-class-component';
30
30
  import BasePopper from "./common/base-popper.vue";
31
31
  import { Inject } from "vue-property-decorator";
32
- import { Emit, Prop } from "../reg";
32
+ import { Register, Emit, Prop } from "@ui-root/reg";
33
33
  import { ViewCtrlInfo } from "../types";
34
34
  import SuTree from "./tree/index.vue";
35
35
  import ViewControl from "./view-control.vue";
@@ -37,7 +37,7 @@ import ViewControl from "./view-control.vue";
37
37
 
38
38
  import "../global-style.css";
39
39
 
40
- @Options({
40
+ @Register({
41
41
  name:"su-select",
42
42
  components:{
43
43
  BasePopper,
@@ -7,11 +7,11 @@
7
7
  </template>
8
8
 
9
9
  <script lang="ts">
10
- import { Options, Vue } from 'vue-class-component';
11
- import { Prop, Emit } from "../reg";
10
+ import { Vue } from 'vue-class-component';
11
+ import { Register, Prop, Emit } from "@ui-root/reg";
12
12
  import "../global-style.css";
13
13
 
14
- @Options({
14
+ @Register({
15
15
  name:"su-slider"
16
16
  })
17
17
  export default class SuSlider extends Vue {
@@ -1,19 +1,19 @@
1
1
  <template>
2
2
  <div :class="['star-ui','star-ui-switch','star-ui-size-'+size]">
3
3
  <label>
4
- <input ref="input" type="checkbox" :name="name" :checked="modelValue" @change="handeleChange"/>
5
- <div><span></span></div>
6
- </label>
4
+ <input ref="input" type="checkbox" :name="name" :checked="modelValue" @change="handeleChange"/>
5
+ <div><span></span></div>
6
+ </label>
7
7
  </div>
8
8
  </template>
9
9
 
10
10
  <script lang="ts">
11
- import { Options, Vue } from 'vue-class-component';
11
+ import { Vue } from 'vue-class-component';
12
12
  import { Watch } from "vue-property-decorator";
13
- import { Prop, Emit } from "../reg";
13
+ import { Register, Prop, Emit } from "@ui-root/reg";
14
14
  import "../global-style.css";
15
15
 
16
- @Options({
16
+ @Register({
17
17
  name:"su-switch"
18
18
  })
19
19
  export default class SuInput extends Vue {
@@ -35,61 +35,61 @@ export default class SuInput extends Vue {
35
35
  default:"medium"
36
36
  })
37
37
  size!:string;
38
- @Emit("update:modelValue")
39
- private handeleChange():boolean{
40
- const nowChecked = this.$refs.input.checked;
41
- this.$refs.input.checked = this.modelValue;
42
- return nowChecked;
43
- }
44
- @Watch("modelValue")
45
- private modelValueChange(newValue:boolean){
46
- this.$refs.input.checked = newValue;
47
- }
38
+ @Emit("update:modelValue")
39
+ private handeleChange():boolean{
40
+ const nowChecked = this.$refs.input.checked;
41
+ this.$refs.input.checked = this.modelValue;
42
+ return nowChecked;
43
+ }
44
+ @Watch("modelValue")
45
+ private modelValueChange(newValue:boolean){
46
+ this.$refs.input.checked = newValue;
47
+ }
48
48
  }
49
49
  </script>
50
50
 
51
51
  <style>
52
52
  .star-ui-switch{
53
- --size: 20px;
54
- display: inline-block;
53
+ --size: 20px;
54
+ display: inline-block;
55
55
  }
56
56
  .star-ui-switch.star-ui-size-medium{
57
- --size: calc(var(--star-ui-input-medium-font-size) * 1.2);
57
+ --size: calc(var(--star-ui-input-medium-font-size) * 1.2);
58
58
  }
59
59
  .star-ui-switch.star-ui-size-mini{
60
- --size: calc(var(--star-ui-input-mini-font-size) * 1.2);
60
+ --size: calc(var(--star-ui-input-mini-font-size) * 1.2);
61
61
  }
62
62
  .star-ui-switch input{
63
- display: none;
63
+ display: none;
64
64
  }
65
65
  .star-ui-switch div{
66
- width: calc(var(--size) * 2.5);
67
- height: var(--size);
68
- border: solid 1px var(--star-ui-base-color);
69
- border-radius: var(--size);
70
- overflow: hidden;
66
+ width: calc(var(--size) * 2.5);
67
+ height: var(--size);
68
+ border: solid 1px var(--star-ui-base-color);
69
+ border-radius: var(--size);
70
+ overflow: hidden;
71
71
  }
72
72
  .star-ui-switch div span{
73
- display: inline-block;
74
- width: calc(var(--size) - 2px);
75
- height: calc(var(--size) - 2px);
76
- border-radius: 50%;
77
- border: solid 1px var(--star-ui-base-color);
78
- position: relative;
79
- background: var(--star-ui-backgorund-color);
80
- transition: margin-left 0.1s;
73
+ display: inline-block;
74
+ width: calc(var(--size) - 2px);
75
+ height: calc(var(--size) - 2px);
76
+ border-radius: 50%;
77
+ border: solid 1px var(--star-ui-base-color);
78
+ position: relative;
79
+ background: var(--star-ui-backgorund-color);
80
+ transition: margin-left 0.1s;
81
81
  }
82
82
  .star-ui-switch div span::before{
83
- content: "";
84
- width: 100px;
85
- height: 100px;
86
- background: var(--star-ui-base-color);
87
- position: absolute;
88
- right: 50%;
89
- top:-20px;
90
- z-index: -1;
83
+ content: "";
84
+ width: 100px;
85
+ height: 100px;
86
+ background: var(--star-ui-base-color);
87
+ position: absolute;
88
+ right: 50%;
89
+ top:-20px;
90
+ z-index: -1;
91
91
  }
92
92
  .star-ui-switch input:checked+div span{
93
- margin-left: calc(var(--size) * 1.5);
93
+ margin-left: calc(var(--size) * 1.5);
94
94
  }
95
95
  </style>
@@ -17,12 +17,12 @@
17
17
  </template>
18
18
 
19
19
  <script lang="ts">
20
- import { Options, Vue } from 'vue-class-component';
21
- import { Prop } from "../reg";
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
- @Options({
25
+ @Register({
26
26
  name:"su-table",
27
27
  props: {
28
28
  data:{
@@ -11,14 +11,14 @@
11
11
  </template>
12
12
 
13
13
  <script lang="ts">
14
- import { Options, Vue } from 'vue-class-component';
15
- import { Prop } from "../../reg";
14
+ import { Vue } from 'vue-class-component';
15
+ import { Register, Prop } from "@ui-root/reg";
16
16
  import treeItem from "./tree-item.vue"
17
17
 
18
18
 
19
19
  import "../../global-style.css";
20
20
 
21
- @Options({
21
+ @Register({
22
22
  name:"su-tree",
23
23
  components:{
24
24
  treeItem
@@ -22,18 +22,19 @@
22
22
  </template>
23
23
 
24
24
  <script lang="ts">
25
- import { Options, Vue } from 'vue-class-component';
26
- import { Prop } from "../../reg";
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
- @Options({
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;
@@ -5,10 +5,9 @@
5
5
  </template>
6
6
 
7
7
  <script lang="ts">
8
- import { Options, Vue } from 'vue-class-component';
9
- import { InjectionKey } from 'vue';
8
+ import { Vue } from 'vue-class-component';
10
9
 
11
- import { Prop } from "../reg";
10
+ import { Register, Prop } from "@ui-root/reg";
12
11
  import { Provide } from "vue-property-decorator";
13
12
 
14
13
  import { ViewCtrlInfo } from "../types";
@@ -17,7 +16,7 @@ import "../global-style.css";
17
16
  type DeviceType='auto'|'mobile'|'pc';
18
17
 
19
18
 
20
- @Options({
19
+ @Register({
21
20
  name:"su-view-control",
22
21
  watch:{
23
22
  $isMobile(newValue){
@@ -0,0 +1,10 @@
1
+ export default {
2
+ mounted(el:HTMLElement, cb:any){
3
+ el.addEventListener("mousemove", () => {
4
+ cb.value(true);
5
+ });
6
+ el.addEventListener("mouseout", () => {
7
+ cb.value(false);
8
+ });
9
+ }
10
+ }
@@ -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{
@@ -1,10 +1,8 @@
1
- @font-face {font-family: "star-ui-iconfont";
2
- src: url('iconfont.eot?t=1618646407015'); /* IE9 */
3
- src: url('iconfont.eot?t=1618646407015#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
- url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAWUAAsAAAAADCgAAAVHAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCEIgqIQIZWATYCJAM0CxwABCAFhU0HgU0bVwqjolYvSnqyv0iwg+GPDWu9hkAksM2maagQEYmIcQTvcMQX5Fovfm7Fw3/7/W+fmbk2973/P2JSyR41EYp4Y9FcExVKIpMCWTxZe/P9pl7VqBlJ5cvEaTencEeJkQfUZkm+Zha7mWo6l1/Tv722OcCWzFR6MCyc7Z+/36s/KRKojj0AePe/qPO7qWJNFfRxmEBr7PYi2wBnE9aZiFdvYjo6e+N1AtV6KZyO1LX0AE8FnReIKzxHA89WRJmxhd7fjtxaxGtu+vQkOeRV/vPx3cKTpMnoTSfP1bKg4hNLXIwzo6nZyLi7FIy7yNgLKMTd0cx1LmV9LxfVq7o6CfhP6yXpU/l0wU3PJyb4BHBC80S4oGq1WIj8Jw/IWr1OIyTFoBpNiBYpE2XRu1b0E4gpMp+cKFo+OVP0fHIJ6Tx0RUgD5BASwEHINsF5kPFwIUIG4CKEVOBihIzAJeBOTDu9ZTVgAYi1QDxGxjMyWSjTyY8SQQQFxPj6xgYHBxGEv39QkNq6KKTHbAzttSzeawqj+mwmLWVdtKtDRlK7F4fjxci6LWTUjENDF+8Mn21bI3E2055FISxaYoBshIObHj77yZOep097nz/ve/ZsNJKogjTpAXn6AabZ5aS9BRlz9jSrae/i0F7Otni3MYQ1mznOtnHPiZJsfbwldHu4bUPYbLT5lD0NzLYegWSxJthMErIe27X+eKrrdifZwjc/YgRajLu8/RftMbVSixm0j6hPgKVe9Lzju0NdjbsWhSHrhnCrTWLNJ/aEuZ3EpdCyPsRirqRwJL54cWHEwqTTHp0VgfftoiKOGjjetOLIbKJ9xE4cmRVtv3iRiqzdfmVqit9WZeq1qyYfn2g/KTFlO0gxEMSyYCTOokRIkQkJIfgSQWSLh0ZiQLrknnb59y+flnRKEqEeM25NXu/y6JELxPUqgaCGfLuj6oIQQRxxDCSXIFJRuyCFdkVt7515BiIcBfCiB/ZvnxZGKiPtz57u2IcjEyIXnr2YdBQPDIYpOXcJPuiVoedL8pfk0pcPyPv7nGfFO5XqrvKu6DqnxApHi3KcQ4GVwKrG14q7TdXdbsU5lcqhdMwfrwA3GnpeB6mcP2dnf3MW+eG2oeeNm1i6v39cgQMPB48qx6l+hxK8/3F977f5vr3izsKkAOvi+QlY5e6i8YUg8GuG/STDf5g9zO9zPkA+6uzw1He0ebZrzkvcE+lLjhVvEpVPHnM8SMJJ91IFAKQP6a+QAOPzPGX/ts6FMyr504//glUfN51YqczuFIdv9BJs9vfNMhcVn6fotLjzF58qMLWPC7+KkCoH+JUXFnt3GN8y9nDCgtAaks42yBakqIu+BBqjo9Ba0AfVHtzdoyVWcRFlwG7bBYSN7kMy5zdkG/1XFVPEQmN5lErtmL4bqlMhPXK0PW7XwyKkZciSA2Mkzwg6FJ0je0syLaYO8amdrXZBbkhDi0PTOt9JQVHiBR2ZmZYx3KqHOige4gppmMuSZUQiUdCSdeHboEYjkHpRUEFGThuUZX1Rejoa+6I0RtACb4eJIJoMYpEGjCHxGAIdlDpl3q5200SphpTlU2erXSDOUzSMOTHnNJehwB0ofHv3SJnSZGygrld0G017KTSuHsbJIpMhJEQUTS1SnZmCNLIuIOnHT1KBGLI0gxtU9YqkK8shrpJ2eJ/2PdoEFX3SNFLkKNFEG130MUSNMSYxjTnltMBCN0YjSGk3pHXuEtTcr1O9aVEURlI1EMmeVWxI3xfZOKrzwQiR5wblwLmDUhGv0fA6juBM1/Vui8fi4PW8GwYA') format('woff2'),
5
- url('iconfont.woff?t=1618646407015') format('woff'),
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,48 @@
1
1
  //布局
2
- import SuHLayout from "./components/layout-h.vue";
3
- import SuVLayout from "./components/layout-v.vue";
4
- import SuMain from "./components/layout-main.vue";
5
- import SuTable from "./components/table.vue";
6
- import SuHLine from "./components/line-h.vue";
7
- import SuVLine from "./components/line-v.vue";
8
- import SuCard from "./components/card.vue";
9
- import SuTree from "./components/tree/index.vue";
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
- import SuInput from "./components/input.vue";
12
- import SuSelect from "./components/select.vue";
13
- import SuButton from "./components/button.vue";
14
- import SuSwitch from "./components/switch.vue";
15
- import SuSlider from "./components/slider.vue";
11
+ export { default as SuInput } from "./components/input.vue";
12
+ export { default as SuSelect } from "./components/select.vue";
13
+ export { default as SuButton } from "./components/button.vue";
14
+ export { default as SuSwitch } from "./components/switch.vue";
15
+ export { default as SuSlider } from "./components/slider.vue";
16
16
 
17
17
 
18
- import SuCalendar from "./components/calendar.vue";
18
+ export { default as SuCalendar } from "./components/calendar.vue";
19
19
 
20
- import ViewControl from "./components/view-control.vue";
20
+ export { default as SuViewControl } from "./components/view-control.vue";
21
21
 
22
- import { App } from 'vue';
22
+ export * from "./components/menu";
23
+ export * from "./components/content";
23
24
 
24
- declare interface IObj {
25
- // eslint-disable-next-line
26
- [key: string]: any,
27
- }
28
- export const components={SuHLayout,SuVLayout,SuMain,SuHLine,SuVLine,SuCard,SuTree,SuTable,SuButton,SuInput,SuSelect,ViewControl,SuSwitch,SuCalendar,SuSlider} as IObj;
29
- //export components;
30
- const registComponents=function(app:App):void{
31
- for(const key in components){
32
- app.component(components[key].__o.name,components[key]);
25
+ import { data } from "./reg";
26
+
27
+ import { App, readonly } from "vue";
28
+
29
+ // eslint-disable-next-line
30
+ export const components:Record<string,any>={};
31
+ Object.keys(data).map((key) => {
32
+ if(data[key].component&&!data[key].internalOnly){
33
+ components[key]=data[key].component;
33
34
  }
35
+ });
36
+ export const allData = readonly(data);
37
+
38
+ const registComponents=function(app:App):void{
39
+ Object.keys(data).map((key) => {
40
+ if(data[key].component&&!data[key].internalOnly){
41
+ app.component(components[key].__o.name,components[key]);
42
+ }
43
+ });
34
44
  }
45
+ export const infos = readonly(data);
35
46
  export default {
36
47
  ...components,
37
48
  components,
package/src/reg.ts CHANGED
@@ -1,14 +1,35 @@
1
- import { VueDecorator, PropOptions, createDecorator } from 'vue-class-component';
2
- import { reactive } from 'vue';
3
-
1
+ import { VueDecorator, PropOptions, createDecorator, Vue, VueConstructor, VueBase } from "vue-class-component";
2
+ import { ComponentOptions, reactive } from "vue";
3
+ interface ComponentInfo{
4
+ hideInDoc?:boolean;
5
+ internalOnly?:boolean;
6
+ type?:'from'|'layout';
7
+ }
4
8
 
5
9
  export const data = reactive({
6
10
  //
7
11
  } as {[key:string]: {
8
12
  props?:{
9
13
  [key:string]: PropOptions
14
+ };
15
+ component?:VueConstructor<VueBase>;
16
+ }&ComponentInfo});
17
+
18
+ export type RegisterOptions<V> = ComponentOptions & ThisType<V> & ComponentInfo;
19
+ export function Register<V extends Vue>({ hideInDoc, internalOnly, ...options }:RegisterOptions<V>):<VC extends VueConstructor<VueBase>>(target: VC) => VC{
20
+ return (Component) => {
21
+ if(options.name){
22
+ if(!data[options.name]) data[options.name] = {};
23
+ // eslint-disable-next-line
24
+ data[options.name].component = Component;
25
+ data[options.name].hideInDoc = hideInDoc;
26
+ data[options.name].internalOnly = internalOnly;
27
+ }
28
+ // eslint-disable-next-line
29
+ (Component as any).__o = options
30
+ return Component
10
31
  }
11
- }});
32
+ }
12
33
 
13
34
  const hyphenate = (str:string) => str.replace(/\B([A-Z])/g, '-$1').toLowerCase();
14
35
  // eslint-disable-next-line
@@ -62,7 +83,6 @@ export function Emit(event?:string, shouldEmit?:(res:any)=>boolean):VueDecorator
62
83
  export function Prop(propOptions:PropOptions):VueDecorator{
63
84
  return createDecorator((componentOptions, key) => {
64
85
  if(componentOptions.name){
65
- // console.log(componentOptions.name);
66
86
  if(!data[componentOptions.name]) data[componentOptions.name] = {};
67
87
  if(!data[componentOptions.name].props) data[componentOptions.name].props={};
68
88
  // eslint-disable-next-line
@@ -71,4 +91,4 @@ export function Prop(propOptions:PropOptions):VueDecorator{
71
91
  if(!componentOptions.props) componentOptions.props={};
72
92
  componentOptions.props[key] = propOptions;
73
93
  });
74
- }
94
+ }
package/src/types.d.ts CHANGED
@@ -1,3 +1,9 @@
1
1
  export interface ViewCtrlInfo{
2
2
  isMobile?:boolean;
3
3
  }
4
+ export interface MenuItem{
5
+ name?:string;
6
+ path:string;
7
+ title:string;
8
+ children?:MenuItem[];
9
+ }
package/src/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Vue } from 'vue-class-component';
1
+ import { Vue } from "vue-class-component";
2
2
 
3
3
  export function getParentNodeByClass(node:HTMLElement,className:string):HTMLElement|null{
4
4
  let p:HTMLElement|null = node;
@@ -0,0 +1,5 @@
1
+ import { Vue } from "vue-class-component";
2
+ import "../global-style.css";
3
+ export default class SuButton extends Vue {
4
+ size: string;
5
+ }
@@ -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 { ViewCtrlInfo } from "../../types";
3
+ import "../../global-style.css";
4
+ export default class SuButton extends Vue {
5
+ fromItem: Vue | HTMLElement;
6
+ private div;
7
+ private id;
8
+ private updateType;
9
+ private visible;
10
+ readonly suControl: ViewCtrlInfo;
11
+ beforeCreate(): void;
12
+ unmounted(): void;
13
+ mounted(): void;
14
+ beforeUnmount(): void;
15
+ _clickCheck(ev: MouseEvent): boolean;
16
+ private syncRequestId;
17
+ _updateVisible(): void;
18
+ updatePos(): void;
19
+ }
@@ -0,0 +1 @@
1
+ export { default as SuPage } from "./page.vue";
@@ -0,0 +1,10 @@
1
+ import { Vue } from "vue-class-component";
2
+ import { ViewCtrlInfo } from "../../types";
3
+ import "@ui-root/global-style.css";
4
+ export default class SuMain extends Vue {
5
+ readonly suControl: ViewCtrlInfo;
6
+ private title;
7
+ private logo;
8
+ private menu;
9
+ private isOpenMenu;
10
+ }
@@ -0,0 +1,15 @@
1
+ import { Vue } from 'vue-class-component';
2
+ import "../global-style.css";
3
+ export default class SuInput extends Vue {
4
+ modelValue: string | number;
5
+ $refs: {
6
+ input: HTMLInputElement;
7
+ };
8
+ name: string;
9
+ size: string;
10
+ isFocused: boolean;
11
+ emitInput(data: string): string;
12
+ handleInput(event: InputEvent): void;
13
+ handleFocus(): void;
14
+ handleBlur(): void;
15
+ }