@thestarweb/ui 1.5.2 → 1.7.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 (71) hide show
  1. package/dist/star-ui.common.js +9086 -1335
  2. package/dist/star-ui.common.js.map +1 -1
  3. package/dist/star-ui.umd.js +9088 -1337
  4. package/dist/star-ui.umd.js.map +1 -1
  5. package/dist/star-ui.umd.min.js +139 -139
  6. package/dist/star-ui.umd.min.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/button.vue +4 -4
  9. package/src/components/calendar.vue +8 -8
  10. package/src/components/card.vue +1 -1
  11. package/src/components/common/base-popper.vue +28 -27
  12. package/src/components/content/context-menu-box/index.vue +117 -0
  13. package/src/components/content/index.ts +5 -1
  14. package/src/components/{menu → content/menu}/index.vue +2 -2
  15. package/src/components/{menu → content/menu}/menu-h/index.vue +3 -1
  16. package/src/components/{menu → content/menu}/menu-h/menu-h-child.vue +0 -0
  17. package/src/components/{menu → content/menu}/menu-h/menu-h-item.vue +4 -3
  18. package/src/components/{menu → content/menu}/menu-v/index.vue +0 -0
  19. package/src/components/content/modals/confirm.vue +45 -0
  20. package/src/components/content/modals/modal.vue +110 -0
  21. package/src/components/content/page.vue +2 -1
  22. package/src/components/form/form/form-item.vue +116 -0
  23. package/src/components/form/form/form.vue +109 -0
  24. package/src/components/form/form/index.ts +2 -0
  25. package/src/components/form/index.ts +1 -0
  26. package/src/components/input.vue +2 -1
  27. package/src/components/layout/auto-direction/index.vue +28 -0
  28. package/src/components/layout/index.ts +1 -0
  29. package/src/components/layout-h.vue +4 -4
  30. package/src/components/layout-main.vue +2 -2
  31. package/src/components/layout-v.vue +4 -4
  32. package/src/components/line-h.vue +2 -2
  33. package/src/components/line-v.vue +2 -2
  34. package/src/components/select.vue +6 -6
  35. package/src/components/switch.vue +1 -1
  36. package/src/components/table.vue +11 -11
  37. package/src/components/tree/index.vue +1 -0
  38. package/src/components/view-control.vue +12 -19
  39. package/src/func/download.ts +15 -0
  40. package/src/func/index.ts +2 -0
  41. package/src/func/modal/index.ts +72 -0
  42. package/src/global-style.css +75 -1
  43. package/src/main.ts +5 -1
  44. package/src/outher/index.ts +5 -1
  45. package/src/reg.ts +38 -3
  46. package/src/types.d.ts +6 -0
  47. package/types/components/common/base-popper.vue.d.ts +5 -2
  48. package/types/components/content/context-menu-box/index.vue.d.ts +20 -0
  49. package/types/components/content/index.d.ts +4 -0
  50. package/types/components/{menu → content/menu}/index.vue.d.ts +0 -0
  51. package/types/components/{menu → content/menu}/menu-h/index.vue.d.ts +0 -0
  52. package/types/components/{menu → content/menu}/menu-h/menu-h-child.vue.d.ts +0 -0
  53. package/types/components/{menu → content/menu}/menu-h/menu-h-item.vue.d.ts +0 -0
  54. package/types/components/{menu → content/menu}/menu-v/index.vue.d.ts +0 -0
  55. package/types/components/content/modals/confirm.vue.d.ts +7 -0
  56. package/types/components/content/modals/modal.vue.d.ts +12 -0
  57. package/types/components/form/form/form-item.vue.d.ts +22 -0
  58. package/types/components/form/form/form.vue.d.ts +24 -0
  59. package/types/components/form/form/index.d.ts +2 -0
  60. package/types/components/form/index.d.ts +1 -0
  61. package/types/components/layout/auto-direction/index.vue.d.ts +4 -0
  62. package/types/components/layout/index.d.ts +1 -0
  63. package/types/components/view-control.vue.d.ts +1 -0
  64. package/types/func/download.d.ts +1 -0
  65. package/types/func/index.d.ts +2 -0
  66. package/types/func/modal/index.d.ts +13 -0
  67. package/types/main.d.ts +3 -1
  68. package/types/outher/index.d.ts +3 -0
  69. package/types/reg.d.ts +10 -1
  70. package/src/components/menu/index.ts +0 -1
  71. package/types/components/menu/index.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thestarweb/ui",
3
- "version": "1.5.2",
3
+ "version": "1.7.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",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <button :class="['star-ui', 'star-ui-container', 'star-ui-button','star-ui-size-'+size]">
2
+ <button :class="['star-ui', 'su-container', 'star-ui-container', 'star-ui-button', 'star-ui-size-'+size]">
3
3
  <slot></slot>
4
4
  </button>
5
5
  </template>
@@ -27,8 +27,8 @@ export default class SuButton extends Vue {
27
27
  <style>
28
28
  .star-ui-button{
29
29
  border-width: 1px;
30
- }
31
- .star-ui-button.star-ui-size-mini{
32
- border-radius:2px;
30
+ cursor: pointer;
31
+ background: var(--star-ui-backgorund-color);
32
+ color: var(--star-ui-font-color);
33
33
  }
34
34
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="star-ui star-ui-calendar">
2
+ <div class="star-ui su-calendar star-ui-calendar">
3
3
  <div class="star-ui-calendar--ctrl" :style="{opacity: showSelYear||showSelMonth?0:1}">
4
4
  <div @click="dYear--">&lt;&lt;</div>
5
5
  <div @click="dMonth--">&lt;</div>
@@ -12,11 +12,11 @@
12
12
  <div @click="dYear++">&gt;&gt;</div>
13
13
  </div>
14
14
  <table cellspacing="0" cellpadding="0" :style="{opacity: showSelYear||showSelMonth?0:1}">
15
- <tr class="su-calendar--inner-head">
16
- <th :class="`su-calendar--${item.week}`" v-for="(item,index) in displayHead" :key="index">{{item.display}}</th>
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="['su-calendar--inner-cell',`su-calendar--${day.week}`,{'su-calendar--previous':day.isPrevious,'su-calendar--next':day.isNext}]" @clcik="dateClick(day)">
19
+ <td v-for="(day,index) in row" :key="index" :class="['star-ui-calendar--inner-cell',`star-ui-calendar--${day.week}`,{'star-ui-calendar--previous':day.isPrevious,'star-ui-calendar--next':day.isNext}]" @clcik="dateClick(day)">
20
20
 
21
21
  <slot v-if="$slots['default']" v-bind="day" />
22
22
  <vnodes v-else-if="renderCell" :func="renderCell" :args="[day]" />
@@ -189,17 +189,17 @@ export default class SuCalendar extends Vue {
189
189
  .star-ui-calendar th,.star-ui-calendar td{
190
190
  padding: 5px 0;
191
191
  }
192
- .su-calendar--inner-head{
192
+ .star-ui-calendar--inner-head{
193
193
  background-color: var(--star-ui-table-head-color);
194
194
  }
195
- .su-calendar--inner-cell{
195
+ .star-ui-calendar--inner-cell{
196
196
  border: 1px solid #e8eaec;
197
197
  width: 42px
198
198
  }
199
- .su-calendar--inner-cell.su-calendar--Sat,.su-calendar--inner-cell.su-calendar--Sun{
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
- .su-calendar--inner-cell.su-calendar--previous,.su-calendar--inner-cell.su-calendar--next{
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,5 +1,5 @@
1
1
  <template>
2
- <div class="star-ui star-ui-card">
2
+ <div class="star-ui su-card star-ui-card">
3
3
  <div v-if="title!=''||collapsible||this.$slots.title" class="star-ui star-ui-container star-ui-card--inner-head">
4
4
  <div class="star-ui star-ui-card--inner-title">{{title}}</div>
5
5
  <button v-if="collapsible" :class="['star-ui','star-ui-card--inner-button-collapsible',isCollaps?'show':'hidden']" @click="collapsChange"></button>
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <teleport :to="'#'+id">
3
- <div>
2
+ <teleport to="body">
3
+ <div ref="root" :class="['star-ui-base-popper', ...ctrlClass]" :style="{visibility: visible ? '' : 'hidden', ...baseStyle, ...style}">
4
4
  <div class="star-ui-popper-background" v-if="isMobile" @click="$emit('out-click')"></div>
5
5
  <slot></slot>
6
6
  </div>
@@ -8,15 +8,16 @@
8
8
  </template>
9
9
 
10
10
  <script lang="ts">
11
- import { Options, Vue } from 'vue-class-component';
12
- import { SuViewCtrlInjectIsMobile } from "@ui-root/outher";
13
- import { Emit, Prop } from "@ui-root/reg";
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
15
  import "../../global-style.css";
16
16
  let nowId=0;
17
17
 
18
- @Options({
18
+ @Register({
19
19
  name:"su-base-popper",
20
+ internalOnly:true,
20
21
  props: {
21
22
  fromItem:{
22
23
  type:Object
@@ -37,11 +38,18 @@ let nowId=0;
37
38
  watch:{
38
39
  visible(){
39
40
  this._updateVisible();
41
+ },
42
+ isMobile(){
43
+ if(this.syncRequestId)cancelAnimationFrame(this.syncRequestId);
44
+ this.updatePos();
40
45
  }
41
46
  },
42
47
  // inject: ['$suControl']
43
48
  })
44
49
  export default class SuButton extends Vue {
50
+ declare $refs: {
51
+ root:HTMLDivElement;
52
+ };
45
53
  @Prop({
46
54
  type:Object
47
55
  })
@@ -51,16 +59,6 @@ export default class SuButton extends Vue {
51
59
  private updateType!:string;
52
60
  private visible!:boolean;
53
61
  @SuViewCtrlInjectIsMobile readonly isMobile!:false;
54
- beforeCreate():void{
55
- this.div=document.createElement("div");
56
- document.body.append(this.div);
57
- this.id="star-ui-popper-"+nowId++;
58
- this.div.id=this.id;
59
- this.div.style.position="fixed";
60
- }
61
- unmounted():void{
62
- document.body.removeChild(this.div);
63
- }
64
62
  mounted():void{
65
63
  window.addEventListener("click",this._clickCheck);
66
64
  this._updateVisible();
@@ -72,7 +70,7 @@ export default class SuButton extends Vue {
72
70
  _clickCheck(ev:MouseEvent):boolean{
73
71
  var dom=ev.target;
74
72
  while(dom&&dom!=document){
75
- if(dom==this.div||(this.fromItem&&dom==((this.fromItem instanceof HTMLElement)?this.fromItem:this.fromItem.$el))){
73
+ if(dom==this.$refs.root||(this.fromItem&&dom==((this.fromItem instanceof HTMLElement)?this.fromItem:this.fromItem.$el))){
76
74
  return false;
77
75
  }
78
76
  dom=(dom as HTMLElement).parentElement;
@@ -82,24 +80,24 @@ export default class SuButton extends Vue {
82
80
  private syncRequestId!:number;
83
81
  _updateVisible():void{
84
82
  if(this.visible){
85
- this.div.style.display="";
86
83
  this.updatePos();
87
84
  }else{
88
- this.div.style.display="none";
89
85
  if(this.syncRequestId)cancelAnimationFrame(this.syncRequestId);
90
86
  }
91
87
  }
88
+ @SuViewCtrlInjectClassName
89
+ readonly ctrlClass!:string[];
90
+ // eslint-disable-next-line
91
+ private baseStyle:Record<string, any>={};
92
92
  updatePos():void{
93
93
  if(this.fromItem){
94
+ this.baseStyle={};
94
95
  let dom=(this.fromItem instanceof HTMLElement)?this.fromItem:this.fromItem.$el;
95
96
  if(this.isMobile){
96
- this.div.style.bottom="0";
97
- this.div.style.left="0";
98
- this.div.style.width="100%";
99
- // this.div.style.height="100%";
100
- this.div.className="star-ui su-view-control su-view-control-mobile";
97
+ this.baseStyle.bottom="0";
98
+ this.baseStyle.left="0";
99
+ this.baseStyle.width="100%";
101
100
  }else{
102
- this.div.className="star-ui su-view-control su-view-control-pc";
103
101
  const height=dom.clientHeight;
104
102
  let top=0,left=0;
105
103
  while(dom&&dom!=document){
@@ -108,8 +106,8 @@ export default class SuButton extends Vue {
108
106
  dom=dom.offsetParent;
109
107
  }
110
108
  top+=height;
111
- this.div.style.top=top+"px";
112
- this.div.style.left=left+"px";
109
+ this.baseStyle.top=top+"px";
110
+ this.baseStyle.left=left+"px";
113
111
  if(this.updateType=="v-sync"){
114
112
  this.syncRequestId=requestAnimationFrame(this.updatePos);
115
113
  }
@@ -120,6 +118,9 @@ export default class SuButton extends Vue {
120
118
  </script>
121
119
 
122
120
  <style>
121
+ .star-ui-base-popper{
122
+ position: fixed;
123
+ }
123
124
  .star-ui-popper-background{
124
125
  position: fixed;
125
126
  width: 100%;
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <div class="star-ui su-context-menu-box star-ui-context-menu-box" @contextmenu="handleContextMenu">
3
+ <slot />
4
+ </div>
5
+ <teleport to="body" v-if="isOpenMenu">
6
+ <div ref="mask" :class="['su-context-menu--mask', 'star-ui-context-menu--mask', ...ctrlClass]" @click="handleMaskClick">
7
+ <component :is="component" class="su-context-menu star-ui-context-menu" :style="isMobile ? '' : `top: ${currentY}px; left: ${currentX}px;`" :menu="currentMenu" :itemComponent="itemComponent">
8
+ <template v-slot="data">
9
+ <div class="su-context-menu--item star-ui-context-menu--item" @click="handleItemClick(data)">
10
+ <span class="star-ui-context-menu--text">{{data.title}}</span>
11
+ <span v-if="!data.click">&gt;</span>
12
+ </div>
13
+ </template>
14
+ </component>
15
+ </div>
16
+ </teleport>
17
+ </template>
18
+
19
+ <script lang="ts">
20
+ import { Vue } from "vue-class-component";
21
+ import { Prop, Register } from "@ui-root/reg";
22
+ import { SuViewCtrlInjectClassName, SuViewCtrlInjectIsMobile } from "@ui-root/outher";
23
+ import MenuBox from "../menu/menu-h/menu-h-child.vue";
24
+ import MenuBoxMobile from "../menu/menu-v/index.vue";
25
+ import MenuItem from "../menu/menu-h/menu-h-item.vue";
26
+ import "@ui-root/global-style.css";
27
+ import { ContextMenuItem } from "@ui-root/types";
28
+
29
+ @Register({
30
+ name:"su-context-menu-box",
31
+ components: {
32
+ MenuBox,
33
+ MenuBoxMobile,
34
+ }
35
+ })
36
+ export default class SuMain extends Vue {
37
+ private itemComponent = MenuItem;
38
+ declare $refs:{
39
+ mask:HTMLDivElement,
40
+ };
41
+ @SuViewCtrlInjectIsMobile readonly isMobile!:boolean;
42
+ @SuViewCtrlInjectClassName readonly ctrlClass!:string[];
43
+ private get component(){
44
+ if(this.isMobile){
45
+ return MenuBoxMobile;
46
+ }
47
+ return MenuBox;
48
+ }
49
+ @Prop({
50
+ type: [Array, Function],
51
+ required: true,
52
+ })
53
+ private menu!:ContextMenuItem[] | ((ev: MouseEvent) => ContextMenuItem[]);
54
+ private isOpenMenu = false;
55
+ private currentMenu: ContextMenuItem[] = [];
56
+ private currentX = 0;
57
+ private currentY = 0;
58
+ private handleContextMenu(ev: MouseEvent){
59
+ // ev.stopPropagation();
60
+ ev.preventDefault();
61
+ if(typeof this.menu === 'function'){
62
+ this.currentMenu = this.menu(ev) || [];
63
+ }else{
64
+ this.currentMenu = this.menu || [];
65
+ }
66
+ // this.currentMenu=[{title: 'aa', children: [ {title: 'aa.1', click: () => console.log('aa.1 click')} ]}, {title: 'bb', click: () => console.log('bb click')}];
67
+ this.currentX=ev.clientX;
68
+ this.currentY=ev.clientY;
69
+ this.isOpenMenu = true;
70
+ }
71
+ handleMaskClick(ev: MouseEvent){
72
+ if (ev.target === this.$refs.mask) {
73
+ this.isOpenMenu = false;
74
+ }
75
+ }
76
+ handleItemClick(item: ContextMenuItem){
77
+ if (item.click) {
78
+ this.isOpenMenu = false;
79
+ item.click();
80
+ }
81
+ }
82
+ }
83
+ </script>
84
+
85
+ <style>
86
+ .star-ui-context-menu--mask{
87
+ position: fixed;
88
+ top: 0;
89
+ left: 0;
90
+ width: 100%;
91
+ height: 100%;
92
+ }
93
+ .star-ui-context-menu{
94
+ position: absolute;
95
+ opacity: 1;
96
+ }
97
+ .star-ui-context-menu--item{
98
+ min-width: 100px;
99
+ padding: var(--star-ui-default-padding);
100
+ cursor: pointer;
101
+ display: flex;
102
+ flex-direction: row;
103
+ }
104
+ .star-ui-context-menu--text{
105
+ flex: 1;
106
+ }
107
+ .star-ui-view-control-mobile.star-ui-context-menu--mask{
108
+ background: var(--star-ui-mask-color);
109
+ }
110
+ .star-ui-view-control-mobile .star-ui-context-menu{
111
+ width: 100%;
112
+ background-color: var(--star-ui-backgorund-color);
113
+ position: absolute;
114
+ bottom: 0;
115
+ left: 0;
116
+ }
117
+ </style>
@@ -1 +1,5 @@
1
- export { default as SuPage } from "./page.vue";
1
+ export { default as SuPage } from "./page.vue";
2
+ export { default as SuMenu } from "./menu/index.vue";
3
+ export { default as SuContextMenuBox } from "./context-menu-box/index.vue";
4
+ export { default as SuModal } from "./modals/modal.vue";
5
+ export { default as SuModalConfirm } from "./modals/confirm.vue";
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <component :is="menuComponent" :menu="menu" class="su-menu">
2
+ <component :is="menuComponent" :menu="menu" class="star-ui su-menu star-ui-menu">
3
3
  <template v-slot="data">
4
4
  <div @click="handleItemClick(data)">
5
5
  <slot v-if="$slots['default']" v-bind="data" />
@@ -79,7 +79,7 @@ export default class SuHMenu extends Vue {
79
79
 
80
80
  </script>
81
81
  <style>
82
- .su-menu a{
82
+ .star-ui-menu a{
83
83
  color: inherit;
84
84
  text-decoration: none;
85
85
  }
@@ -2,7 +2,9 @@
2
2
  <div :class="['star-ui', 'star-ui-menu', 'star-ui-menu-h']">
3
3
  <su-h-menu-item v-for="item in menu" :key="item.path" :item="item" childDirection="bottom">
4
4
  <template v-slot="data">
5
- <slot v-bind="data" />
5
+ <div class="star-ui star-ui-menu--item star-ui-menu-h--item">
6
+ <slot v-bind="data" />
7
+ </div>
6
8
  </template>
7
9
  </su-h-menu-item>
8
10
  </div>
@@ -1,8 +1,9 @@
1
1
  <template>
2
2
  <div class="star-ui star-ui-menu--item-box star-ui-menu-h--item-box">
3
- <div class="star-ui star-ui-menu--item star-ui-menu-h--item">
3
+ <!-- <div class="star-ui star-ui-menu--item star-ui-menu-h--item" @click="handleItemClick(item)">
4
4
  <slot v-bind="item" />
5
- </div>
5
+ </div> -->
6
+ <slot v-bind="item" />
6
7
  <su-h-menu-child :menu="item.children || []" :itemComponent="selfClass" :direction="childDirection">
7
8
  <template v-slot="item">
8
9
  <slot v-bind="item" />
@@ -12,7 +13,7 @@
12
13
  </template>
13
14
 
14
15
  <script lang="ts">
15
- import { Register, Prop } from "@ui-root/reg";
16
+ import { Register, Prop, Emit } from "@ui-root/reg";
16
17
  import { Vue } from "vue-class-component";
17
18
  import SuHMenuChild from "./menu-h-child.vue";
18
19
  import isFocus from "@ui-root/directives/is-focus";
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <su-modal :visible="visible" @close="close">
3
+ <template v-slot:title>
4
+ {{title}}
5
+ </template>
6
+ <template v-slot:footer>
7
+ <su-button @click="confirm">确认</su-button>
8
+ <su-button @click="close">取消</su-button>
9
+ </template>
10
+ </su-modal>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ import { Vue } from 'vue-class-component';
15
+ import { Register, Prop, Emit } from "@ui-root/reg";
16
+ import SuModal from "./modal.vue";
17
+ import {SuButton} from "@ui-root/main";
18
+
19
+ @Register({
20
+ name:"su-modal-confirm",
21
+ components:{
22
+ SuModal,
23
+ SuButton
24
+ },
25
+ hideInDoc: true,
26
+ })
27
+ export default class SuModalConfirm extends Vue {
28
+ @Prop({
29
+ type: String,
30
+ })
31
+ private readonly title!:string|undefined;
32
+ @Prop({
33
+ type: Boolean,
34
+ })
35
+ private readonly visible!:boolean|undefined;
36
+ @Emit()
37
+ private close(){
38
+ return 1;
39
+ }
40
+ @Emit()
41
+ private confirm(){
42
+ return 1;
43
+ }
44
+ }
45
+ </script>
@@ -0,0 +1,110 @@
1
+ <template>
2
+ <teleport to="body" v-if="locVisable">
3
+ <div class="star-ui-modal--mask">
4
+ <div class="star-ui star-ui-modal su-modal">
5
+ <div class="star-ui-modal--header">
6
+ <div class="star-ui-modal--title">
7
+ <slot name="title" />
8
+ {{title}}
9
+ </div>
10
+ <i class="star-ui-icon-font star-ui-icon-close" @click="close"/>
11
+ </div>
12
+ <div class="star-ui-modal--body">
13
+ <slot />
14
+ </div>
15
+ <div class="star-ui-modal--footer">
16
+ <slot name="footer" />
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </teleport>
21
+ </template>
22
+
23
+ <script lang="ts">
24
+ import { Vue } from 'vue-class-component';
25
+ import { Register, Prop, Emit } from "@ui-root/reg";
26
+ import "@ui-root/global-style.css";
27
+ import { SuViewCtrlInjectIsMobile } from '@ui-root/outher';
28
+
29
+ @Register({
30
+ name:"su-modal",
31
+ watch: {
32
+ visible(v){
33
+ console.log(v)
34
+ if (typeof v !== 'undefined') {
35
+ this.locVisable = v;
36
+ }
37
+ },
38
+ },
39
+ })
40
+ export default class SuModalConfirm extends Vue {
41
+ @Prop({
42
+ type: Boolean,
43
+ default: undefined
44
+ })
45
+ private readonly visible!:boolean|undefined;
46
+ private locVisable = false;
47
+ @Emit('update:visable')
48
+ private updateVisable(visable:boolean):boolean{
49
+ return visable;
50
+ }
51
+ @Emit()
52
+ public close():void{
53
+ if(typeof this.visible === 'undefined'){
54
+ this.locVisable = false;
55
+ }
56
+ this.updateVisable(false);
57
+ }
58
+ public show():void{
59
+ if(typeof this.visible === 'undefined'){
60
+ this.locVisable = true;
61
+ }
62
+ this.updateVisable(true);
63
+ }
64
+ @Prop({
65
+ type: String,
66
+ })
67
+ private readonly title!:string|undefined;
68
+ created():void{
69
+ if (typeof this.visible !== 'undefined') {
70
+ this.locVisable = this.visible;
71
+ }
72
+ }
73
+ @SuViewCtrlInjectIsMobile readonly isMobile!: boolean;
74
+ }
75
+ </script>
76
+
77
+ <style>
78
+ .star-ui-modal{
79
+ background-color: var(--star-ui-backgorund-color);
80
+ border-radius: var(--star-ui-border-radius);
81
+ }
82
+ .star-ui-modal--mask{
83
+ position: fixed;
84
+ top: 0;
85
+ left: 0;
86
+ width: 100vw;
87
+ height: 100vh;
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: center;
91
+ background-color: var(--star-ui-mask-color);
92
+ }
93
+ .star-ui-modal--header,
94
+ .star-ui-modal--body,
95
+ .star-ui-modal--footer{
96
+ padding: var(--star-ui-default-padding);
97
+ }
98
+ .star-ui-modal--header{
99
+ display: flex;
100
+ flex-direction: row;
101
+ }
102
+ .star-ui-modal--title{
103
+ flex: 1 1 0;
104
+ overflow: hidden;
105
+ }
106
+ .star-ui-modal--header>i{
107
+ flex: 0 0 auto;
108
+ cursor: pointer;
109
+ }
110
+ </style>
@@ -36,7 +36,7 @@
36
36
  import { Vue } from "vue-class-component";
37
37
  import { Prop, Register } from "@ui-root/reg";
38
38
  import { SuViewCtrlInjectIsMobile } from "@ui-root/outher";
39
- import { SuMenu } from "@ui-root/components/menu";
39
+ import { SuMenu } from "@ui-root/main";
40
40
  import { MenuItem } from "@ui-root/types";
41
41
  import "@ui-root/global-style.css";
42
42
 
@@ -129,5 +129,6 @@ export default class SuMain extends Vue {
129
129
  }
130
130
  .su-page--main{
131
131
  overflow: auto;
132
+ flex: 1;
132
133
  }
133
134
  </style>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div :class="`star-ui su-form-item star-ui-form-item star-ui-col-${col} star-ui-form--label-align-${labelAlign||pLabelAlign}`">
3
+ <div ref="labelDiv" class="start-ui star-ui-container star-ui-form-item--label" :style="labelStyle">
4
+ {{label}}
5
+ <slot name="label"></slot>
6
+ </div>
7
+ <div class="start-ui star-ui-container star-ui-form-item--content">
8
+ <slot></slot>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ import { Vue } from "vue-class-component";
15
+ import { Inject } from "vue-property-decorator";
16
+ import { Register, Prop } from "@ui-root/reg";
17
+ import { TypeFormLabelAlign } from "@ui-root/outher";
18
+ import { Bus } from "./form.vue";
19
+
20
+ import "@ui-root/global-style.css";
21
+
22
+ export const InjectLabelWidth = Symbol('InjectLabelWidth');
23
+ export const InjectLabelAlign = Symbol('InjectLabelAlign');
24
+ export const InjectEventBus = Symbol('InjectEventBus');
25
+
26
+ @Register({
27
+ name:"su-form-item",
28
+ hideInDoc:true,
29
+ watch:{
30
+ label(this:SuButton){
31
+ this.bus&&this.bus.labelUpdate(this);
32
+ }
33
+ }
34
+ })
35
+ export default class SuButton extends Vue {
36
+ declare $refs: {
37
+ labelDiv: HTMLDivElement
38
+ };
39
+ @Prop({
40
+ type:String,
41
+ default:()=>{
42
+ return 'label';
43
+ }
44
+ })
45
+ readonly label!:string;
46
+ @Prop({
47
+ type:[String, Number],
48
+ })
49
+ readonly labelWidth!:string|number|undefined;
50
+ @Inject({from:InjectLabelWidth,default:undefined})
51
+ readonly pLabelWidth!:string|number|undefined;
52
+ @Prop({
53
+ autoType: "FormLabelAlign",
54
+ })
55
+ readonly labelAlign!:TypeFormLabelAlign;
56
+ @Inject({from:InjectLabelAlign,default:"right"})
57
+ readonly pLabelAlign!:TypeFormLabelAlign;
58
+ @Prop({
59
+ type:Number,
60
+ default:()=>{
61
+ return 24;
62
+ }
63
+ })
64
+ readonly col!:number;
65
+ private get labelStyle():Record<string, unknown>{
66
+ const ret:Record<string, unknown>={};
67
+ const labelWidth = this.labelWidth || this.pLabelWidth;
68
+ if(labelWidth){
69
+ ret.width=typeof labelWidth === 'number' ? `${labelWidth}px` : labelWidth;
70
+ }
71
+ return ret;
72
+ }
73
+ @Inject({from:InjectEventBus})
74
+ readonly bus!:Bus|undefined;
75
+ created(){
76
+ if(this.bus){
77
+ this.bus.addItem(this);
78
+ }
79
+ }
80
+ beforeUnmount(){
81
+ if(this.bus){
82
+ this.bus.removeItem(this);
83
+ }
84
+ }
85
+ }
86
+ </script>
87
+
88
+ <style>
89
+ .star-ui-form-item{
90
+ display: flex;
91
+ flex-direction: row;
92
+ align-items: center;
93
+ overflow: hidden;
94
+ }
95
+ .star-ui-form-item--label{
96
+ overflow: hidden;
97
+ box-sizing: border-box;
98
+ }
99
+ .star-ui-form-item--content{
100
+ flex: 1;
101
+ }
102
+ .star-ui-form-item--content>.star-ui-select,.star-ui-form-item--content>.star-ui-input{
103
+ width: 100%;
104
+ }
105
+
106
+ .star-ui-form--label-align-left .star-ui-form-item--label, .star-ui-form--label-align-top .star-ui-form-item--label{
107
+ text-align: left;
108
+ }
109
+ .star-ui-form--label-align-right .star-ui-form-item--label{
110
+ text-align: right;
111
+ }
112
+ .star-ui-form-item.star-ui-form--label-align-top{
113
+ flex-direction: column;
114
+ align-items: stretch;
115
+ }
116
+ </style>