@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.
Files changed (86) hide show
  1. package/build-ts/main.js +24 -4
  2. package/dist/star-ui.common.js +2394 -1319
  3. package/dist/star-ui.common.js.map +1 -1
  4. package/dist/star-ui.umd.js +2394 -1319
  5. package/dist/star-ui.umd.js.map +1 -1
  6. package/dist/star-ui.umd.min.js +75 -75
  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 +4 -4
  11. package/src/components/calendar.vue +11 -11
  12. package/src/components/call-render.tsx +4 -3
  13. package/src/components/card.vue +5 -5
  14. package/src/components/common/base-popper.vue +12 -14
  15. package/src/components/content/index.ts +1 -0
  16. package/src/components/content/page.vue +133 -0
  17. package/src/components/form/form/form-item.vue +96 -0
  18. package/src/components/form/form/form.vue +51 -0
  19. package/src/components/form/form/index.ts +2 -0
  20. package/src/components/form/index.ts +1 -0
  21. package/src/components/input.vue +5 -4
  22. package/src/components/layout-h.vue +7 -8
  23. package/src/components/layout-main.vue +5 -4
  24. package/src/components/layout-v.vue +7 -6
  25. package/src/components/line-h.vue +11 -10
  26. package/src/components/line-v.vue +11 -10
  27. package/src/components/menu/index.ts +1 -0
  28. package/src/components/menu/index.vue +86 -0
  29. package/src/components/menu/menu-h/index.vue +66 -0
  30. package/src/components/menu/menu-h/menu-h-child.vue +74 -0
  31. package/src/components/menu/menu-h/menu-h-item.vue +65 -0
  32. package/src/components/menu/menu-v/index.vue +56 -0
  33. package/src/components/select.vue +13 -15
  34. package/src/components/slider.vue +3 -3
  35. package/src/components/switch.vue +44 -44
  36. package/src/components/table.vue +14 -14
  37. package/src/components/tree/index.vue +4 -3
  38. package/src/components/tree/tree-item.vue +5 -4
  39. package/src/components/view-control.vue +23 -25
  40. package/src/directives/is-focus.ts +10 -0
  41. package/src/global-style.css +76 -1
  42. package/src/icon-font/iconfont.css +17 -7
  43. package/src/icon-font/iconfont.json +22 -1
  44. package/src/icon-font/iconfont.ttf +0 -0
  45. package/src/icon-font/iconfont.woff +0 -0
  46. package/src/icon-font/iconfont.woff2 +0 -0
  47. package/src/main.ts +38 -25
  48. package/src/outher/index.ts +8 -0
  49. package/src/reg.ts +62 -7
  50. package/src/types.d.ts +6 -0
  51. package/src/utils.ts +1 -1
  52. package/types/components/button.vue.d.ts +5 -0
  53. package/types/components/calendar.vue.d.ts +26 -0
  54. package/types/components/card.vue.d.ts +13 -0
  55. package/types/components/common/base-popper.vue.d.ts +19 -0
  56. package/types/components/content/index.d.ts +1 -0
  57. package/types/components/content/page.vue.d.ts +9 -0
  58. package/types/components/form/form/form-item.vue.d.ts +15 -0
  59. package/types/components/form/form/form.vue.d.ts +8 -0
  60. package/types/components/form/form/index.d.ts +2 -0
  61. package/types/components/form/index.d.ts +1 -0
  62. package/types/components/input.vue.d.ts +15 -0
  63. package/types/components/layout-h.vue.d.ts +4 -0
  64. package/types/components/layout-main.vue.d.ts +4 -0
  65. package/types/components/layout-v.vue.d.ts +4 -0
  66. package/types/components/line-h.vue.d.ts +4 -0
  67. package/types/components/line-v.vue.d.ts +4 -0
  68. package/types/components/menu/index.d.ts +1 -0
  69. package/types/components/menu/index.vue.d.ts +12 -0
  70. package/types/components/menu/menu-h/index.vue.d.ts +8 -0
  71. package/types/components/menu/menu-h/menu-h-child.vue.d.ts +7 -0
  72. package/types/components/menu/menu-h/menu-h-item.vue.d.ts +8 -0
  73. package/types/components/menu/menu-v/index.vue.d.ts +9 -0
  74. package/types/components/select.vue.d.ts +26 -0
  75. package/types/components/slider.vue.d.ts +29 -0
  76. package/types/components/switch.vue.d.ts +12 -0
  77. package/types/components/table.vue.d.ts +5 -0
  78. package/types/components/tree/index.vue.d.ts +15 -0
  79. package/types/components/tree/tree-item.vue.d.ts +18 -0
  80. package/types/components/view-control.vue.d.ts +16 -0
  81. package/types/directives/is-focus.d.ts +4 -0
  82. package/types/main.d.ts +70 -6
  83. package/types/outher/index.d.ts +5 -0
  84. package/types/reg.d.ts +24 -2
  85. package/dist/img/iconfont.ff1d7f50.svg +0 -62
  86. package/types/utils.d.ts +0 -3
@@ -1,14 +1,14 @@
1
1
  <template>
2
- <div class="star-ui su-table">
3
- <table class="star-ui su-table--inner" rules="none" frame="void">
4
- <thead class="star-ui su-table--inner-thead">
5
- <tr class="star-ui su-table--inner-tr">
6
- <th v-for="item in columns" :key="item.name+item.key" class="star-ui star-ui-container su-table--inner-th">{{item.name}}</th>
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 su-table--inner-tbody">
10
- <tr v-for="(row,index) in data" :key="index" class="star-ui su-table--inner-tr">
11
- <td v-for="item in columns" :key="item.name+item.key" class="star-ui star-ui-container su-table--inner-td">{{row[item.field]}}</td>
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 { 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:{
@@ -47,13 +47,13 @@ export default class SuTable extends Vue {
47
47
  </script>
48
48
 
49
49
  <style>
50
- .su-tabl{
50
+ .star-ui-tabl{
51
51
  width: 100%;
52
52
  }
53
- .su-table--inner-thead{
53
+ .star-ui-table--inner-thead{
54
54
  background-color: var(--star-ui-table-head-color);
55
55
  }
56
- .su-table--inner-tr{
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 { Options, Vue } from 'vue-class-component';
15
- import { Prop } from "../../reg";
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
- @Options({
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 { 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;
@@ -1,47 +1,27 @@
1
1
  <template>
2
- <div :class="['star-ui', 'su-view-control', $isMobile?'su-view-control-mobile':'su-view-control-pc']">
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 { 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";
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
- @Options({
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
 
@@ -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{
@@ -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 {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,50 @@
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 * 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
- import SuCalendar from "./components/calendar.vue";
19
+ export { default as SuCalendar } from "./components/calendar.vue";
19
20
 
20
- import ViewControl from "./components/view-control.vue";
21
+ export { default as SuViewControl } from "./components/view-control.vue";
21
22
 
22
- import { App } from 'vue';
23
+ export * from "./components/menu";
24
+ export * from "./components/content";
23
25
 
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]);
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 'vue-class-component';
2
- import { reactive } from 'vue';
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
- export function Prop(propOptions:PropOptions):VueDecorator{
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] = propOptions;
124
+ componentOptions.props[key] = {
125
+ ...eData,
126
+ ...propOptions
127
+ };
73
128
  });
74
- }
129
+ }
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 "../../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";
@@ -0,0 +1,9 @@
1
+ import { Vue } from "vue-class-component";
2
+ import "@ui-root/global-style.css";
3
+ export default class SuMain extends Vue {
4
+ readonly isMobile: boolean;
5
+ private title;
6
+ private logo;
7
+ private menu;
8
+ private isOpenMenu;
9
+ }